首页 > 其他 > 详细

xib嵌套使用注意

时间:2015-03-26 20:14:48      阅读:298      评论:0      收藏:0      [点我收藏+]

http://www.tuicool.com/articles/ENv6Nf

 

// 被使用的xib需要重写此方法

- (instancetype)initWithCoder:(NSCoder *)coder
{
    self = [super initWithCoder:coder];
    if (self) {
        
//        UIView *containerView = [[UINib nibWithNibName:@"SecondView" bundle:nil] instantiateWithOwner:self options:nil][0];
        
        UIView *containerView = [[NSBundle mainBundle] loadNibNamed:@"SecondView" owner:self options:nil][0];
        
        CGRect newFrame = CGRectMake(0, 0, self.frame.size.width, self.frame.size.height);
        
        containerView.frame = newFrame;
        
        [self addSubview:containerView];
        
    }
    return self;
}

xib嵌套使用注意

原文:http://www.cnblogs.com/jzlblog/p/4369369.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!