UIView创建的两种方式

    //通过xib创建
    NSBundle    * bundle = [NSBundle mainBundle];
    NSArray     * arr = [bundle loadNibNamed:@"myView" owner:self options:nil];
    UIView      * myView = [arr objectAtIndex:0];
    
    //通过代码创建
    CGRect      viewRect = CGRectMake(0, 0, 100, 100);
    UIView      * myView = [[UIView alloc] initWithFrame:viewRect];
原文地址:https://www.cnblogs.com/benbenzhu/p/3328809.html