私はARCに比較的慣れていません。UIView
2 つのラベル (タイトルとサブタイトル) を持つサブクラスを作成しています。ラベルをプロパティとして公開するのではなく、テキストのみを公開します。
私は現在これを使用しています:
@interface MyView : UIView
@property (nonatomic, strong) NSString *title;
@property (nonatomic, strong) NSString *subtitle;
@end
@implementation MyView
{
UILabel *_titleLabel;
UILabel *_subtitleLabel;
}
- (void)setTitle:(NSString *)title
{
[_titleLabel setText:title];
}
- (NSString *)title
{
return [_titleLabel text];
}
- (void)setSubtitle:(NSString *)subtitle
{
[_subtitleLabel setText:title];
}
- (NSString *)subtitle
{
return [_subtitleLabel text];
}
@end
私の 2 つの @properties は正しく宣言されていますか? strong
、weak
またはその他の修飾子を使用する必要がありますか? なぜ?