1.在xib中获取UIView
当xib的name跟关联的view的类名一致时。
>WNXUnLoginView *view = [[[NSBundle mainBundle] loadNibNamed:NSStringFromClass([WNXUnLoginView class]) owner:nil options:nil] lastObject];
通用的方式
WNXUnLoginView *view = [[[NSBundle mainBundle] loadNibNamed:@"WNXUnLoginView" owner:nil options:nil] lastObject];
2.在xib中获取UITableViewCell对象(以下两种方式一致)
WNXRmndCell *cell = [[[NSBundle mainBundle] loadNibNamed:NSStringFromClass([WNXRmndCell class]) owner:nil options:nil] lastObject];
WNXRmndCell *cell = [[[NSBundle mainBundle] loadNibNamed:@"WNXRmndCell" owner:nil options:nil] lastObject];
3.在xib中获取UIViewController对象
GHViewController *vc = [[GHViewController alloc]initWithNibName:@"GHViewController" bundle:nil];
4.在storyBoard中获取UIViewController对象
//@"registerLogin"是标识。
RegisterAndLoginController *registerAndLoginVC = [[UIStoryboard storyboardWithName:@"OtherSB" bundle:nil]instantiateViewControllerWithIdentifier:@"registerLogin"];