【发布时间】:2012-01-02 12:37:35
【问题描述】:
我想知道我编程的方式是否正确。你能帮帮我吗?
@interface ViewController : UIViewController
{
UILabel *messageLabel;
}
@end
当我在 .h 中声明新对象并在 .m 中创建时,我必须使用@property (nonatomic, retain) UILabel *messageLabel?我看到很少有列表,其中当对象由代码 @property 创建时不存在,并且很少存在,我很困惑。
当我通过代码创建对象时不使用@property(例如UILabel、UIImageView、UIButton)是否正确?
【问题讨论】:
-
如果你打算使用这些对象中的信息在视图之间传递,你只需要@property。
标签: objective-c coding-style properties implementation declare