Question

Does anyone have an idea how :

  1. ... WhatsApp is able to push the UIImagePickerController on to the navigation controller stack as seen when you launch WhatsApp > Settings > Chat settings > Background > Photo Library.
  2. ... WhatsApp is able to load the Photo Libray so quickly. When I load it, it hangs for a couple of seconds before it shows.

Any help would be greatly appreciated.

Below is what I came up with so far. It's far from ideal. It still shows the Cancel button in the up right, it can not always find a topViewController and the same delay is noticeable (as also with the default approach by presenting the view controller)

if (!_imagePickerController)
{
    _imagePickerController = [[UIImagePickerController alloc] init];
    [_imagePickerController setSourceType:UIImagePickerControllerSourceTypePhotoLibrary];
    [_imagePickerController setMediaTypes:@[(NSString *)kUTTypeImage]];
    [_imagePickerController setDelegate:self];
    [_imagePickerController viewWillAppear:YES];
    [_imagePickerController viewDidAppear:YES];
}

[self.navigationController pushViewController:_imagePickerController.topViewController animated:YES];
Était-ce utile?

La solution

It probably uses its own photo picker implemented on top of the Assets Library Framework. The downside of this is that you have to write your own code that parses and displays the library, on the upside, however, you have full control over the appearance.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top