Tuesday, January 21, 2014

Matching UIKeyboard speed and curve to your animation

I have a ViewController in my Xamarin.iOS application, where i scale the View Frame when the keyboard shows. However, I had some trouble with matching the speed and curve of the animation to the keyboards animation. Though I found a pretty good solution, which takes the values from the keyboard itself, through the UIKeyboardWillShowNotification.

Friday, January 17, 2014

Disabling ActionBar menu items

I have some use cases where I want to temporarily disable ActionBar menu items, such that they are not clickable, but also so they are a different color from the active ones. The default SetEnabled method on IMenuItem does not do this for you. Sure it disables the item, however the visual state does not change. Hence, I found a nifty way to change this and made my own SetEnabled extension method.

Using this extension method can grey out menu items, so they appear disabled from a UX perspective. The method takes some more parameters, as it needs to get the resource id of the Drawable you want to use for the greyed out item and the current Context, such that it can get it from the application resources.