从UIImagePickerController摄像头视图中推送viewController

Eya*_*yal 8 iphone objective-c uiimagepickercontroller ios

我正在开发一个消息传递应用程序(类似于WhatsApp),用户可以相互发送文本和图像消息.

当用户想要发送图像时,他可以从相机胶卷中选择一个,或者他可以用相机拍摄一个.

这就是我UIImagePickerController为两种情况提出的方式:

- (void)handleTakePhoto
{
    UIImagePickerController *ipc = [[UIImagePickerController alloc] init];

    ipc.delegate = self;
    ipc.sourceType = UIImagePickerControllerSourceTypeCamera;

    [self presentModalViewController:ipc animated:YES];
    [ipc release];
}

- (void)handleChooseFromLibrary
{
    UIImagePickerController *ipc = [[UIImagePickerController alloc] init];
    ipc.delegate = self;
    ipc.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;

    NSString *desired = (NSString *)kUTTypeImage;
    if ([[UIImagePickerController availableMediaTypesForSourceType:UIImagePickerControllerSourceTypePhotoLibrary] containsObject:desired]) {
        ipc.mediaTypes = [NSArray arrayWithObject:desired];
    }

    [self presentModalViewController:ipc animated:YES];
    [ipc release];
}
Run Code Online (Sandbox Code Playgroud)

在用户选择/拍摄照片之后,我正在推动SendImageViewController以全屏显示图像并且具有实际发送图像的按钮.

这是我推动它的方式:

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
    UIImage *image = [info objectForKey:UIImagePickerControllerOriginalImage];


    SendImageViewController *sivc = [[SendImageViewController alloc] initWithImage:image
                                                                          delegate:self];
    [picker pushViewController:sivc animated:YES];
    [sivc release];
}  
Run Code Online (Sandbox Code Playgroud)

当我SendImageViewController从相机胶卷推出时,一切都很好.问题是,SendImageViewController当从相机拍摄图像时我无法推动我,因为相机没有导航栏(我试图推动它但我的SendImageViewController视图不能很好地呈现)

我怎么处理这个?

*我不想解雇拾取器,然后推动SendImageViewController,我希望SendImageViewController它将被推到相机/相机胶卷顶部,所以当我点击后退按钮时,我将返回到相机/相机胶卷视图.

Olo*_*iar 15

尝试显示导航栏,如下所示:

[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackTranslucent animated:YES];
[[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationSlide];

[picker setNavigationBarHidden:NO animated:YES];
[picker pushViewController:vc animated:YES];
Run Code Online (Sandbox Code Playgroud)