Iphone 按下导航栏按钮时如何转到主屏幕
我想在导航栏上添加一个rightbar按钮作为主页按钮 每当我点击那个按钮时,我想进入firstcontroller,那是我的主屏幕 请帮我做这件事Iphone 按下导航栏按钮时如何转到主屏幕,iphone,Iphone,我想在导航栏上添加一个rightbar按钮作为主页按钮 每当我点击那个按钮时,我想进入firstcontroller,那是我的主屏幕 请帮我做这件事 提前感谢如果您的应用程序是基于导航的应用程序,请在按钮的iAction中使用以下代码行 [self.navigationController popToRootViewControllerAnimated:YES]; 如果您的应用程序是基于导航的应用程序,请在按钮的iAction中使用以下代码行 [self.navigationControlle
提前感谢如果您的应用程序是基于导航的应用程序,请在按钮的iAction中使用以下代码行
[self.navigationController popToRootViewControllerAnimated:YES];
如果您的应用程序是基于导航的应用程序,请在按钮的iAction中使用以下代码行
[self.navigationController popToRootViewControllerAnimated:YES];
使用此按钮转到导航栏中的主屏幕,首先创建右栏按钮
{
UIBarButtonItem *Button = [[UIBarButtonItem alloc]
initWithTitle:@"Home"
style:UIBarButtonItemStylePlain
target:self
action:@selector(Button_Action)];
self.navigationItem.rightBarButtonItem = Button;
[Button release];
}
-(void) Button_Action
{
[self.navigationController popToRootViewControllerAnimated:YES];
}
使用此按钮转到导航栏中的主屏幕,首先创建右栏按钮
{
UIBarButtonItem *Button = [[UIBarButtonItem alloc]
initWithTitle:@"Home"
style:UIBarButtonItemStylePlain
target:self
action:@selector(Button_Action)];
self.navigationItem.rightBarButtonItem = Button;
[Button release];
}
-(void) Button_Action
{
[self.navigationController popToRootViewControllerAnimated:YES];
}
您的问题非常误导。您的问题非常误导。感谢您的回复…我创建了另一个自定义视图,并将该视图放置在导航栏上,因此现在我正在向该视图添加按钮。现在我可以转到我想要的控制器,当我点击该按钮时,点击响应按钮…我已经创建了另一个自定义视图,并将该视图放置在导航栏上,因此现在我正在向该视图添加按钮。那么,当我点击该按钮时,现在我可以转到我想要的控制器吗