Reputation: 97
I have created a custom view with a XIB file and are loading the XIB as a UIView several times into my project fine.
But i want to know the size of the UIView that was created with the XIB File. (Not the best idea i know, but just to make sure i'm using the correct size even if the XIB file is resized later)
My code in the viewDidLoad from my UIViewController:
NSArray *nibObjects = [NSBundle.mainBundle loadNibNamed:nibName owner:self options:nil];
coverArticle *pageView = [nibObjects objectAtIndex:0];
[coverArticlesScrollView addSubview:pageView];
NSLog(@"View size: %@",pageView.frame.size.width);
The "pageView.frame.size.width" is returning NULL. Why is this ?
Upvotes: 0
Views: 433
Reputation: 3328
NSLog(@"View Size: %f", pageView.frame.size.width);
width/height is of CGFloat type
Upvotes: 2