I am trying to use this method to show a second modal after a first modal has been dismissed… The method itself works fine, except that it requires me to pass an object as a parameter and what I really want to do is pass a UIImageControllerSourceType instead. Is there another method I should be using to do this or is there an easy way to make UIImageControllerSourceType an object? I feel like this should not be too hard but I have been struggling with it for awhile now…
- (void)showModalTwoImageSearchViewControllerWithSourceType:(UIImagePickerControllerSourceType *)sourceType {
if (self.modalViewController) {
[self performSelector:@selector(showModalTwoImageSearchViewControllerWithSourceType:)
withObject:sourceType
afterDelay:0.1f];
return;
}
// present second modal view - remembering to deal with cases of camera or photo library
if (sourceType == UIImagePickerControllerSourceTypePhotoLibrary) {
//do one thing
}
// lets assume it was UIImagePickerControllerSourceTypeCamera
else {
// do something else
}
}
UIImagePickerControllerSourceTypeis ultimately aNSUIntegerand the method you’re trying to do (the performSelector one) only takes Objective C objects in itswithObjectparameter and not C types or pointers.You can pass
NSUIntegersby creating aNSNumberobject and stuffing your integer into that.To create a
NSNumberobject, you can create one as easily asNSNumber‘snumberWithUnsignedIntegermethod.