开发者

Connecting an IBOutlet to a view within a scrollview within a tab view crashes app. Any ideas?

开发者 https://www.devze.com 2023-03-28 06:48 出处:网络
I used the tabview setup to create an app that has several tabs. One tab has a UIScrollView on it which loads 12 different views into 12 pages. I tried adding a button and imageview to one of the view

I used the tabview setup to create an app that has several tabs. One tab has a UIScrollView on it which loads 12 different views into 12 pages. I tried adding a button and imageview to one of the views and now it crashes. I've pored over every single question on here I can find, and have tried every suggested solution, but to no avail. The error 开发者_StackOverflow中文版that I get is the famous "this class is not key value coding-compliant for the key foo" error. As with everyone else who had this problem, if I disconnect the outlet, it works fine. I've checked and rechecked the class for the nib and it points to the right place.

So I'm not even sure where to go next.

I could post some code, but I don't even know what code would be helpful to post. I'm hoping someone just says, "Um yeah, you can't have a scroll view with multiple views in it and expect to have functionality on each page." That would be helpful!

Page2.h:

#import <UIKit/UIKit.h>

@interface Page2 : UIViewController {

IBOutlet UIImageView *infoImage;

}

@property (retain, nonatomic) UIImageView *infoImage;

  • (IBAction) showInfo:(id)sender;

@end

Page2.m:

- (IBAction)showInfo:(id)sender {

// do something please!

}

Then in the nib file I CTRL-dragged from "touch-up inside" on my button to the Files Owner and chose "showInfo" ... and I CTRL-dragged from Files Owner down to my UIImageView and chose infoImage.

CRASH

I am not cool enough to insert an image: http://i.stack.imgur.com/KjWhk.png


You still have an outlet connected in your nib that you no longer have defined in your class. You'll see in the inspector that it has turned gray. Disconnect it, and the error should be gone.


are u able to create any other outlet in the same Nib file, as i used to get the same crash, and it got fixed only when i duplicated the same nib, i had implemented almost all methods to solve it. If i am not wrong , this link can help you out https://discussions.apple.com/thread/2431110?start=0&tstart=0


I have sent you the email and attached your project. Hope its working at your end now.

Happy Coding!

0

精彩评论

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