Iphone 将“后退”按钮添加到视图控制器
我已经为我的3个Iphone 将“后退”按钮添加到视图控制器,iphone,ios,objective-c,Iphone,Ios,Objective C,我已经为我的3个UIToolBar项目创建了3个UIViewControllers,但我无法在每个控制器上创建一个按钮,将我带回主页或主视图控制器。请帮助我,因为我是新的目标c 这是我的密码 “ViewController.h” 将自定义按钮添加到第二个视图控制器 在viewDidLoad中,您可以这样做 self.navigationItem.rightBarButtonItem = [[[UIBarButtonItem alloc]initWithBarButtonSystemItem:UI
UIToolBar
项目创建了3个UIViewControllers
,但我无法在每个控制器上创建一个按钮,将我带回主页或主视图控制器。请帮助我,因为我是新的目标c
这是我的密码
“ViewController.h”
将自定义按钮添加到第二个视图控制器 在
viewDidLoad
中,您可以这样做
self.navigationItem.rightBarButtonItem = [[[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(doneButtonPressed:)]autorelease];
- (IBAction)doneButtonPressed:(id)sender
{
[self dismissViewControllerAnimated:YES completion:nil];
}
将自定义按钮添加到第二个视图控制器 在
viewDidLoad
中,您可以这样做
self.navigationItem.rightBarButtonItem = [[[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(doneButtonPressed:)]autorelease];
- (IBAction)doneButtonPressed:(id)sender
{
[self dismissViewControllerAnimated:YES completion:nil];
}