-2

我想要的意思是,添加UIToolbarSourceType UIImagePickerControllerPhotoLibrary。

我尝试使用:

[UIViewController presentViewController:UIImagePickerController completion:^{}];

一次就像成功一样。但是,PhotoLibrary 的 UINavigation Back 按钮使用UIToolbar是隐藏的。

请,如何手段或参考,文件,其他。

我试过使用presentViewController: completion: block.

- (void)showPhotoLibrary {

    if ( ![UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary] ) {
        return;
    }

    UIImagePickerController* ipc = [[UIImagePickerController alloc] init];
    [ipc setSourceType:UIImagePickerControllerSourceTypePhotoLibrary];
    [ipc setDelegate:self];

    [self presentViewController:ipc animated:YES completion:^{
        [ipc setToolbarHidden:NO];
    }];
}
4

1 回答 1

0

Self resolved. thank you.

- (void)showPhotoLibrary {

    if ( ![UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary] ) {
        return;
    }

    UIImagePickerController* ipc = [[UIImagePickerController alloc] init];
    [ipc setSourceType:UIImagePickerControllerSourceTypePhotoLibrary];
    [ipc setDelegate:self];

    UIToolbar* tb = [[UIToolbar alloc] init];
    float tbh = 44.0f;
    float tbw = [[ipc view] frame].size.width;
    float tby = [[ipc view] frame].size.height - tbh;
    [tb setFrame:CGRectMake(0, tby, tbw, tbh)];

    [self presentViewController:ipc animated:YES completion:^{
        [[ipc view] addSubview:tb];
    }];
}
于 2013-02-19T01:21:16.113 回答