开发者

Stock UIViewController can't be set as an IBOutlet?

I have a view-based application and I'd like to make a change to which UIView is di开发者_JAVA百科splayed via my UIViewController. I set up an IBOutlet UIViewController *viewController and then linked it in Interface Builder, however whenever I make this link the app crashes right on startup with SIGKILL. Has anyone ever had any experience with this and is there any alternate way to go about what I'm trying to do?

Thanks in advance!


you're doing it the wrong way around. The nib contains the UIViewController, which is synthesized on nib load. The nib also contains the UIView, which is linked to the view property of the UIViewController.

Just add another UIView (or derived class thereof) to the nib and link it to the UIViewController's view property.

In your view controller, you can access this view through the view property.


Have you used the Console to see what reason if threw back for the crash? If you could post it it would go a long way to helping solve the reason for you app throwing sigkill.

You might try just in case a clean build , under build clean all targets then run if it crashes check the console log for what it threw if something that no longer exists is still hooked up in the Interface builder it could be a reason for the crash.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜