please help me with this
this is really erratic I am unable to add a button to navigation bar of modalview
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;
Please help me with this I have tried almost every permutation combination.
Thnx in advance
It looks as if you want to display a mapView in a modal view.
On iPhone, modal views occupy the entire screen, so there is no room for a nav bar. Thus you do not need a navigation controller.
I assume the above code is inside a UIViewController instance. If so, just do this:
In this case, in your your mapView controller, you should add a button that, when pressed does this: