Recently on an application I came across an issue where when I showed a
UIPickerView inside an action sheet the bottom half(ish) of the uipickerview wasn't selectable. I had came across this before when showing buttons in an
UIActionSheet and had overcome it by moving the button slightly higher up the
UIActionSheet. on that project I didn't have enough time to investigate what was causing and was only to hope to hold onto my hack, however when the same issue reared its head again, I decided to crack it. Messing with where my
UIPickerView started produced the same "working" functionality as had moving the buttons up however it also destroyed my UI, by leaving a large black space at the bottom of my
UIActionSheet. Staring at the UI I suddenly noticed the faded tabbar sitting underneath and it occurred to me that this was causing all my trouble somehow it was creating a no-go zone even through it was off the screen and that the adjustment I had made to where the
UIPickerView started just happened to be the same height as the tabbar.
This made my hack feel more concrete and understandable however what if Apple changed the height of the tabbar all my applications would become unresponsive. Up until this point when I wanted to show the
UIActionSheet I was using this method call:
However reading through the Apple documentation I discovered a more robust method:
Using the above method I was able to remove all the messy frame creation that I had been relying upon and also forward proof my application in-case apple did change the height of the navigation bar.
What do you think? Let me know by getting in touch on Twitter - @wibosco