Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

uaecasher

macrumors 65816
Original poster
Jan 29, 2009
1,289
0
Stillwater, OK
Hello,

I'm using a UIActionSheet to let users to choose either a camera or photo library, how ever if a user has an iPod he shouldn't be presented with camera option, so i want to know how to do a conditional inside an action sheet, thank you.

here is my code:

Code:
-(IBAction)selector {
    
    UIActionSheet *actionSheet = [[UIActionSheet alloc]
                                  initWithTitle:@"Choose Source Type?"
                                  delegate:self
                                  cancelButtonTitle:nil
                                  destructiveButtonTitle:nil
                                  otherButtonTitles:@"Select From Library", @"Capture From Camera", nil];
    [actionSheet showInView:self.view];
    [actionSheet release];
    
}


Code:
   if ( (![UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]))
		
	{	
        
     
	}
 
This phrase doesn't make much sense: "conditional inside an action sheet". You put the code that will display the action sheet inside the condition. Note it's the code, not the sheet that goes inside the conditional.
 
Something to consider: if the app is running on a device with no camera, your action sheet will have only one choice ("Select From Library"). In that case, it doesn't make sense, to me at least, to present the user with one choice and then make them pick it; instead, just take the user to that single option right away.
 
Something to consider: if the app is running on a device with no camera, your action sheet will have only one choice ("Select From Library"). In that case, it doesn't make sense, to me at least, to present the user with one choice and then make them pick it; instead, just take the user to that single option right away.

i never thought of that, thanks for the idea :D
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.