xib 加載自定義View
UIView *view = [[NSBundle mainBundle] loadNibNamed:@"MyView" owner:self options:nil][0];
xib 加載自定義控制器
UIViewController *vc = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
storyboard 加載自定義控制器
UIStoryboard*storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
UIViewController*vc = [storyboard instantiateInitialViewController];
xib 加載自定義cell
//第一步在控制器生命周期中注冊
[self.msgTableView registerNib:[UINib nibWithNibName:@"RTJFMyMsgTableViewCell" bundle:nil] forCellReuseIdentifier:cellID];
//第二步在表格數(shù)據(jù)源代理中返回
RTJFMyMsgTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
if (cell == nil) {
cell = [[RTJFMyMsgTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
}
return cell;
最后編輯于 :
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者