0

uilabel を変更しないのはなぜですか?

クラスを作成しましたが、セッターをオーバーライドできません

.h ファイルのコード

@interface ViewController : UIViewController
{
    UILabel * _lblName;
}
@property (retain, nonatomic) IBOutlet UILabel * lblName;

@end

.m ファイルのコード

@synthesize lblName = _lblName;

 

- (void)setLblName:(UILabel *)lblName{
if(![_lblName isEqual:lblName]){
[_lblName release];
_lblName = [lblName retain];}}

 

- (IBAction)didCustomBtnClick:(id)sender {
UILabel* lbl = [[UILabel alloc] initWithFrame:CGRectMake(0.0, 0.0, 100.0, 30.0)];
lbl.text = @"Duck";
self.lblName = lbl;
[lbl release];}
4

0 に答える 0