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