自定义图像选取器在推送自定义视图时删除导航栏

时间:2011-10-11 03:53:23

标签: objective-c cocoa-touch uiimagepickercontroller

在我的项目中,我需要将另一个uiviewcontroller附加到imagepicker链的末尾。

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)img editingInfo:(NSDictionary *)editInfo 
{
uploadPhotoViewController * newView = [[uploadPhotoViewController alloc] initWithNibName:@"uploadPhotoViewController" bundle:nil];
    newView.contest = received;
    newView.receivedImage = img;
    newView.parentImagePicker = picker; // this doesn't help
    [picker pushViewController:newView animated:YES];

}

这很好用,但当我使用相机作为光源时,它会清除导航栏,我无法让它变得可见。我试过平常:

-(void)viewWillAppear:(BOOL)animated 
{
    [super viewWillAppear:animated];
    self.wantsFullScreenLayout = FALSE;
    self.navigatioController.navigationBar.hidden = false;
    self.navigationController.navigationBar.barStyle = UIBarStyleBlackTranslucent;
    [[UIApplication sharedApplication] setStatusBarHidden:NO animated:NO];
    [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackTranslucent animated:YES];
}

状态栏将在推入的视图中返回,但导航栏是另一个野兽。我猜测,因为这是一个模态,导航控制器被发送到下面的视图堆栈。有谁知道如何处理图像选择器?我尝试将图像选择器作为视图控制器的对象传递,如第一个代码块中所示,然后我尝试像这样解决它:

    self.parentImagePicker.navigationBar.hidden = false;
    self.parentImagePicker.navigationBar.barStyle = UIBarStyleBlackTranslucent

但这也没有帮助。所以我很难过。是他们的一些ivar还是可以让我对拣货员说话的东西?

1 个答案:

答案 0 :(得分:4)

哦,很酷,我想通了。而电话

self.navigatioController.navigationBar.hidden = false;

不起作用,

[self.navigationController setNavigationBarHidden:NO];

这一个。