iOS Property getter

阅读 43

2023-05-23


@property (nonatomic, assign, getter=isPlaying)BOOL playing;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    _playView = [PlayView new];
    _playView.frame = CGRectMake(30, 40, 40, 40);
    _playView.backgroundColor = [UIColor redColor];
    [self.view addSubview:_playView];
    
//    UILabel *label = [UILabel new];
//    label.attributedText
//    label.attributedText
    
//    _playView pl
    
//    self.isPlaying = YES;
    
    self.playing = YES;
    
    
//    BOOL on = self.playing; //都可以使用
    
    BOOL on = self.isPlaying; <span style="font-family: Arial, Helvetica, sans-serif;">//都可以使用</span>
    
    NSLog(@"the on is %@", on ? @"YES" : @"ON");
    
    
}




精彩评论(0)

0 0 举报