Closed wjiuxing closed 8 years ago
I did above steps with an Objective-C project. And I found the code works well in Objective-C. But I haven't done anything else but translate the code from Swift to Objective-C. I think there may be bugs in Swift.
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
[PHPhotoLibrary requestAuthorization:^(PHAuthorizationStatus status) {
dispatch_async(dispatch_get_main_queue(), ^{
// init picker
CTAssetsPickerController *picker = [[CTAssetsPickerController alloc] init];
// set delegate
picker.delegate = self;
// set default album (Camera Roll)
self.assetsPicker.defaultAssetCollection = PHAssetCollectionSubtypeSmartAlbumUserLibrary;
// to present picker as a form sheet in iPad
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
picker.modalPresentationStyle = UIModalPresentationFormSheet;
}
// present picker
[self presentViewController:picker animated:YES completion:nil];
});
}];
}
@wjiuxing Noted and thanks.
Hi, I just wanted to share: I've been experiencing the same issue. I tried not using the defaultAssetCollection property, and that fixed it. Any ideas why?
Thanks
I'm getting the same blank screen, but in an Objective-C project. Trying to get my head around it. Did you fix this?
Please refer to #160.
I have a Swift project. I want to present this picker in form sheet on iPad. But it shows me a blank view, see screenshot at the end pls.
Steps to reproduce: 0- I'm using Xcode 7.1.1 1- new a Master-Detail Application in Swift 2- add CTAssetsPickerController to Podfile and run pod install 3- change the MasterViewController
4- run the app and add an entry by clicking on the "+" on the right bar button of MasterViewController 5- click on the new cell inserted above. At this time above code will be called. 6- show a blank page as the image following.
Thank you very much. :)