customCell.m - (void)awakeFromNib { self.label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 50, 200)]; [self.label setBackgroundColor:[UIColor yellowColor]]; [self.label setText:@"Hello"]; [self.myView addSubview:self.label]; CGRect myFrame = self.myView.frame; myFrame.size.height = self.label.frame.size.height; self.myView.frame = myFrame; NSLog(@"%f", self.label.frame.size.height); // Results: 200.0000 } mainViewController.m - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. customCell *cellVC = [[cutsomCell alloc] init]; NSLog(@"%f, %f", cellVC.label.frame.size.height, cellVC.frame.size.height); // Results: 0.0000, 44.0000 }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)