我在UIView
课程中有一个按钮,我需要使用UIViewController
导航到NavigationViewController
课程。我陷入了困境。谁能告诉我解决方案呢
根据用户评论进行修改
-(void)eventDetailView:(id)sender
{
EventDetailPage *eventDetail = [[EventDetailPage alloc]initWithNibName:@"EventDetailPage" bundle:[NSBundle mainBundle]];
[[[[self window] rootViewController] navigationController] pushViewController:eventDetail animated:YES];
}
答案 0 :(得分:0)
你可以用它。它对我很有用: -
首先在UIView类中创建AppDelegate的对象并初始化它。 然后在Appdelegate.h中创建Navigationcontroller对象: -
@property(strong,nonatomic) UINavigationController *navControl;
在你的UIView类中,实现你要推送的代码: -
ViewController *objview = [[ViewController alloc]init];
[appDelegate.navControl pushViewController:objview animated:YES];