Kazmi
Kazmi

Reputation: 593

Cancel Button appears Disable on iOS 5 when using presentViewController

on iOS 4 i am using the following line of code to get the PhotoLibrary and its working perfect and the view can be dismissed with the cancel button appearing on top right side:

[self presentModalViewController:imgPicker animated:YES];

However, on iOS 5 the following line is getting the PhotoLibrary but the "Cancel Button" is Disable, i.e. the view cannot be dismissed with cancel button.

[self  presentViewController:imgPicker animated:YES completion:nil];

Upvotes: 0

Views: 487

Answers (2)

Krishna
Krishna

Reputation: 378

UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];            
[imagePicker setDelegate:self];                
[self presentModalViewController:imagePicker animated:TRUE];

This works fine for me, in iOS 5, too.

Upvotes: 1

Mundi
Mundi

Reputation: 80271

You are not passing a view controller, but a view controller class. Try using your old imgPicker rather than the UIImagePickerController.

Also, there is no such thing as Nil in objective C. It should be nil.

Upvotes: 0

Related Questions