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];

 

你可能感兴趣的:(UIView)