开发者

Warning in @property (nonatomic,retain) UISegmentedControl *colorChooser;

开发者 https://www.devze.com 2023-03-25 10:29 出处:网络
I have created one segmented control anda text view in my .xib file and I have declare it in .h file as

I have created one segmented control and a text view in my .xib file and I have declare it in .h file as

@interface controlsViewControll开发者_StackOverflow中文版er : UIViewController {
    IBOutlet UISegmentedControl *colorChooser;
    IBOutlet UITextView *setText;
}
@property (nonatomic,retain) UISegmentedControl *colorChooser;
@property (nonatomic,retain) UITextView *setText

but it shows me warning on both lines of @property

Can anyone tell me why it warns me?


My guess would be that you don't have a @synthesize or @dynamic in your implementation. That would generate compiler warnings.

The position of the IBOutlet wound not generate a compiler warning as it's a marco of nothing. It's used by xcode resource editor (or the older Interface Builder) to indicate it's a outlet property and doesn't generate any code.


@interface controlsViewController : UIViewController {
    UISegmentedControl *colorChooser;
    UITextView *setText;
}
@property (nonatomic,retain) IBOutlet UISegmentedControl *colorChooser;
@property (nonatomic,retain) IBOutlet UITextView *setText;


You need to synthesize the property in your .m file. You won't get the error then.

0

精彩评论

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