我想添加按下此信息按钮时打开新视图控制器的方法。
UIBarButtonItem *infoItem = [[UIBarButtonItem alloc]
initWithTitle:@"Info"
style:UIBarButtonItemStyleBordered
target:nil
action:@selector(action)];
答案 0 :(得分:2)
-(void)action {
MyViewController *myView = [[MyViewController alloc] initWithNibName:@"MyViewController" bundle:nil];
[myView presentModalViewController:YES]; // present view modally
[self.navigationController pushViewController:myView animated:YES]; // add to navigation stack
[myView release];
}