1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
self.someErrorView = ({ UIView *view = [[UIView alloc] init]; view.backgroundColor = [UIColor redColor]; [view addSubview:({ self.someErrorLabel = ({ UILabel *label = [[UILabel alloc] init]; label.textAlignment = NSTextAlignmentCenter; label.backgroundColor = [UIColor clearColor]; label; }); })]; view; }); [self.view addSubview:self.someErrorView];