iphone:无法显示后退导航栏上的按钮
问题描述:
请帮我这个 这实在是飘忽不定的,我无法将按钮添加到modalview的导航栏iphone:无法显示后退导航栏上的按钮
UINavigationController *tempModalVC=[[UINavigationController alloc] init];
[tempModalVC.navigationBar setBarStyle:UIBarStyleBlack];
//UIBarButtonItem *tempDoneBTN=[[UIBarButtonItem alloc] initWithTitle:@"Done" style:UIBarButtonItemStylePlain target:self action:@selector(hideModalView:)];
UIBarButtonItem *tempDoneBTN=[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(hideModalView:)];
[tempModalVC.navigationItem setBackBarButtonItem:tempDoneBTN];
[tempModalVC.navigationItem setTitle:@"Title"];
tempModalVC.navigationItem.backBarButtonItem.enabled=YES ;
//[tempModalVC.navigationBar setRightBarButtonItem:[[UIBarButtonItem alloc] initWithTitle:@"" style:UIBarButtonItemStyleBordered target:self action:@selector(hideModalView:)]];
//[tempModalVC.navigationItem setRightBarButtonItem:[[UIBarButtonItem alloc] initWithTitle:@"" style:UIBarButtonItemStyleBordered target:self action:@selector(hideModalView:)]];
[tempDoneBTN release];
[tempModalVC.view addSubview:mapView];
tempModalVC.modalPresentationStyle = UIModalPresentationFormSheet;
请帮我这个我已经试过几乎每个排列组合。
日Thnx提前
答
看起来好像要显示在模式视图一个MapView。
在iPhone上,模态视图占据整个屏幕,所以没有空间可以放置导航栏。因此你不需要导航控制器。
我假设上面的代码是在UIViewController实例中。如果是这样,只是这样做:
[self presentModalViewController:mapView animated:YES/NO];
在这种情况下,在你的MapView的控制器,你应该添加一个按钮,按下时做到这一点:
[self dismissModalViewControllerAnimated:YES/NO];