开发者

Controls on UIView does not work after adding uiview to uiwindow

I am trying to work on a universal app for iOS platform, I created a window based application with core data support. In my AppDelegate_iPhone I added this line in applicationDidFinishLaunching [window addSubview:myiPhoneMainView.view]; of course I have creat开发者_如何学Ced & synthesized the myiPhoneMainView variable.

In my MainWindow_iPhone.xib I added a view controller set its class to MyiPhoneMainView and controlled dragged from app delegate to MyiPhoneMainView.

Then I went on & added controls on my MyiPhoneMainView. Everything works fine MyiPhoneMainView gets loaded but the problem is none of the controls are responding to the user events.

I have checked user interaction is enabled on all of them. Niether uibotton nor uitextfield nothing seems to respond to anything.

Can somebody please point out what am I missing.

Thank you .


It sounds like your connections from your view's controls are not linked to the IBActions in your view controller.

Are you loading the controller via initWithNibNamed: or are you just using init? If using initWithNib, then have you linked up the controls in the view with the IBOutlets?

If yes to those, then make sure you are not creating a new view (in the init method or the viewDidLoad of the controller) that replaces the one created in the xib.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜