我之前没有看过这样的语法。有人可以解释这里发生的事情
- (void)viewDidLoad{
[super viewDidLoad];
self.tableView.separatorColor = [UIColor colorWithRed:150/255.0f green:161/255.0f blue:177/255.0f alpha:1.0f];
self.tableView.delegate = self;
self.tableView.dataSource = self;
self.tableView.opaque = NO;
self.tableView.backgroundColor = [UIColor clearColor];
self.tableView.tableHeaderView = ({
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 0, 60.0f)];
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 40, 100, 100)];
imageView.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin;
imageView.image = [UIImage imageNamed:@"avatar.jpg"];
imageView.layer.masksToBounds = YES;
imageView.layer.cornerRadius = 50.0;
imageView.layer.borderColor = [UIColor whiteColor].CGColor;
imageView.layer.borderWidth = 3.0f;
imageView.layer.rasterizationScale = [UIScreen mainScreen].scale;
imageView.layer.shouldRasterize = YES;
imageView.clipsToBounds = YES;
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(20, 30, 0, 24)];
label.text = @"Darren";
label.font = [UIFont fontWithName:@"HelveticaNeue" size:21];
label.backgroundColor = [UIColor clearColor];
label.textColor = [UIColor whiteColor];
[label sizeToFit];
label.autoresizingMask = UIViewAutoresizingFlexibleRightMargin;
//[view addSubview:imageView];
[view addSubview:label];
view;
});
}
分配tableHeaderView时会发生什么?在({})括号内创建和配置视图的目的是什么?以及如何将创建的视图分配给tableHeaderView属性?
提前致谢。