Invalid context error on iOS 7 when adding a UIPickerView inside a UIActionSheet?

前端 未结 3 573
悲哀的现实
悲哀的现实 2021-01-05 00:14

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

3条回答
  •  旧巷少年郎
    2021-01-05 00:20

    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

提交回复
热议问题