I have button for picking image from photo album. After picking image, i need to show navigationBar and share button. But navigationBar is not showing after picking image. I used `[self.navigationController.navigationBar setHidden:NO];. But navigation bar not showing.
code:
-(void)showAlbum:(id)sender{
imagePicker=[[UIImagePickerController alloc]init];
imagePicker.delegate = self;
imagePicker.allowsEditing =NO;
imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
[self presentModalViewController:imagePicker animated:YES];
}
-(void)imagePickerControllerDidCancel:(UIImagePickerController *)picker{
//release picker
[picker dismissModalViewControllerAnimated:YES];
}
-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{
//set image
[self.navigationController.navigationBar setHidden:NO];
newImage = [[UIImageView alloc] initWithImage:[info objectForKey:UIImagePickerControllerOriginalImage]];
[newImage setFrame:CGRectMake(0, 0, 320, 568)];
[self.view addSubview:newImage];
[picker dismissModalViewControllerAnimated:YES];
}
Just hide navigation bar after dismissModalViewController
-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{
//set image
newImage = [[UIImageView alloc] initWithImage:[info objectForKey:UIImagePickerControllerOriginalImage]];
[newImage setFrame:CGRectMake(0, 0, 320, 568)];
[self.view addSubview:newImage];
[picker dismissModalViewControllerAnimated:YES];
[self.navigationController.navigationBar setHidden:NO];
}
Or put this in viewWillAppear
, because this will call after dismiss
your ModalViewController
-(void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:YES];
[self.navigationController.navigationBar setHidden:NO];
}