iOS 如何在视图中添加一个用xib创建的view

NSArray *nib = [[NSBundle mainBundle]loadNibNamed:[pages objectAtIndex:0] owner:self options:nil];
//得到第一个UIView
UIView *tmpCustomView = [nib objectAtIndex:0];
//获得屏幕的Frame
//CGRect tmpFrame = [[UIScreen mainScreen] bounds];
[self.view addSubView:tmpCustomView];
原文地址:https://www.cnblogs.com/lihaibo-Leao/p/3171785.html