从Xib中加载控件
2016-05-05 本文已影响131人
Bryan5137
NSBundle* bundle = [ NSBundle mainBundle];
//加载xib中的view
UIview* subView = [[bundle loadNibNamed:@“xibName” owner:nil options:nil] lastObject];
[self.view addSubview subView];
//获取subView的子控件 按照xib中控件的顺序取得子控件
UIImageView*imageView = subView.subViews[0];
= [subView viewWithTag:0];