I have an UIPickerView inside an UIActionSheet and have done that in a way suggested by many others here at SO:
Add UIPickerView & a Button in Action sheet - How?
how to add UIPickerView in UIActionSheet
The solutions have worked fine until now when testing my app on iOS 7. It still works but I got a lot of "invalid context 0x0" warnings during runtime in Xcode.
The errors are coming with a nice message too:
CGContextSetFillColorWithColor: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update.
Could it be that Apple finally want to stop this kind of solution or is it something we can work around or fix?
A workaround for this 'invalid context 0x0' warning is to init the UIActionSheet with a non nil title (non-nil buttons also resolve the error but result in visual artefacts).
You will then need to adjust the actionsheet's frame for it to position properly in both iOS7 and previous versions (make sure to do this after the showInView method).
As the comments above point out, the UIActionSheet is not designed to be subclassed or take other views.
More info here at Apple:
https://developer.apple.com/library/ios/documentation/uikit/reference/UIActionSheet_Class/Reference/Reference.html#//apple_ref/doc/uid/TP40006801-CH3-DontLinkElementID_2
One approach is to look closer at the DateCell sample code and change that to use an UIPickerView instead:
https://developer.apple.com/library/ios/samplecode/DateCell/Introduction/Intro.html#//apple_ref/doc/uid/DTS40008866-Intro-DontLinkElementID_2
// Use this code To Open Date Picker Or UiPicker View
pragma -mark Bar Button Action
pragma -mark PickerView Delegate