在UIActionSheet中添加UIPickerView时,iOS 7上的上下文错误无效? [英] Invalid context error on iOS 7 when adding a UIPickerView inside a UIActionSheet?

查看:116
本文介绍了在UIActionSheet中添加UIPickerView时,iOS 7上的上下文错误无效?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在UIActionSheet中有一个UIPickerView,并且在SO的许多其他人建议的方式做到了这一点:

I have an UIPickerView inside an UIActionSheet and have done that in a way suggested by many others here at SO:

添加UIPickerView&一个按钮在操作表 - 如何?

如何在UIActionSheet中添加UIPickerView

在iOS 7上测试我的应用程序时,解决方案一直运行良好。它仍然有效但是我在Xcode的运行期间收到了很多无效的上下文0x0警告。

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.


这些错误也带来了一个很好的消息:



CGContextSetFillColorWithColor:无效的上下文0x0。这是一个严重的错误。该应用程序或其使用的库正在使用无效的上下文,从而导致系统稳定性和可靠性的整体降低。此通知是礼貌的:请解决此问题。在即将到来的更新中它将成为一个致命错误。

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.

可能是Apple最终想要停止这种解决方案,还是它我们可以解决或修复的事情?

Could it be that Apple finally want to stop this kind of solution or is it something we can work around or fix?

推荐答案

正如上面的评论指出的那样,UIActionSheet并不是设计为子类或者是其他观点。

As the comments above point out, the UIActionSheet is not designed to be subclassed or take other views.

Apple的更多信息:

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

一种方法是仔细查看DateCell示例代码并改为使用UIPickerView:

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

这篇关于在UIActionSheet中添加UIPickerView时,iOS 7上的上下文错误无效?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆