1
我已經創建了一個工具欄按鈕,並給出action()以導航到其他ViewController.But代碼不適用於Navigation.And不能將圖像分配給button.How can解決這個?如何使用工具欄按鈕創建導航
- (void)viewDidLoad {
[super viewDidLoad];
[self.navigationController setToolbarHidden:NO];
UIToolbar *toolbar = [[UIToolbar alloc] init];
toolbar.frame = CGRectMake(0, 418, 320, 44);
[self.view addSubview:toolbar];
[toolbar release];
UIBarButtonItem *customItem = [[UIBarButtonItem alloc] initWithTitle:@"update" style:UIBarButtonItemStyleBordered target:self action:@selector(updateAddress:)];
NSMutableArray *toolbarItems = [NSMutableArray arrayWithObjects:customItem, nil];
[toolbar setItems:toolbarItems animated:NO];
}
-(void)updateAddress{
DisplayMapViewController *updateView=[[DisplayMapViewController alloc]init];
UINavigationController *navi=[[UINavigationController alloc]initWithRootViewController:updateView];
[self.navigationController popToViewController:navi animated:YES];
}