UIActionSheet UIActionSheetStyleAutomatic
Specifies the style of an action sheet.typedef enum {
UIActionSheetStyleAutomatic = -1,
UIActionSheetStyleDefault = UIBarStyleDefault,
UIActionSheetStyleBlackTranslucent = UIBarStyleBlackTranslucent,
UIActionSheetStyleBlackOpaque = UIBarStyleBlackOpaque,
} UIActionSheetStyle;
Constants
UIActionSheetStyleAutomatic
Takes the appearance of the bottom bar if specified; otherwise, same as UIActionSheetStyleDefault.
UIActionSheetStyleDefault
The default style.
UIActionSheetStyleBlackTranslucent
A black translucent style.
UIActionSheetStyleBlackOpaque
A black opaque style.
UIActionSheet UIActionSheetStyleAutomatic example.
if (existsInInvitedList) {
eventUserInvitedSheet = [[UIActionSheet alloc] initWithTitle:eventObject.name delegate:self
cancelButtonTitle:@"Cancel"
destructiveButtonTitle:nil
otherButtonTitles:@"Join", @"Decline", @"Chat creator", nil];
eventUserInvitedSheet.actionSheetStyle = UIActionSheetStyleAutomatic;
[eventUserInvitedSheet showFromTabBar:self.tabBarController.tabBar];
}else if (existsInAcceptedList){
eventUserAcceptedSheet = [[UIActionSheet alloc] initWithTitle:eventObject.name delegate:self
cancelButtonTitle:@"Cancel"
destructiveButtonTitle:nil
otherButtonTitles:@"Revoke invite", @"Chat creator", nil];
eventUserAcceptedSheet.actionSheetStyle = UIActionSheetStyleAutomatic;
[eventUserAcceptedSheet showFromTabBar:self.tabBarController.tabBar];
}
eventUserInvitedSheet = [[UIActionSheet alloc] initWithTitle:eventObject.name delegate:self
cancelButtonTitle:@"Cancel"
destructiveButtonTitle:nil
otherButtonTitles:@"Join", @"Decline", @"Chat creator", nil];
eventUserInvitedSheet.actionSheetStyle = UIActionSheetStyleAutomatic;
[eventUserInvitedSheet showFromTabBar:self.tabBarController.tabBar];
}else if (existsInAcceptedList){
eventUserAcceptedSheet = [[UIActionSheet alloc] initWithTitle:eventObject.name delegate:self
cancelButtonTitle:@"Cancel"
destructiveButtonTitle:nil
otherButtonTitles:@"Revoke invite", @"Chat creator", nil];
eventUserAcceptedSheet.actionSheetStyle = UIActionSheetStyleAutomatic;
[eventUserAcceptedSheet showFromTabBar:self.tabBarController.tabBar];
}
Example of [UIActionSheet UIActionSheetStyleAutomatic].
UIActionSheet *actionSheet = [[UIActionSheet alloc] init];
actionSheet.actionSheetStyle = UIActionSheetStyleAutomatic;
actionSheet.title = @"some text";//here type your information text
actionSheet.delegate = self;
[actionSheet addButtonWithTitle:@"Button 1"];
[actionSheet addButtonWithTitle:@"Button 2"];
[actionSheet setCancelButtonIndex:1];
//it is up to you how you show it, I like the tabbar
[actionSheet showFromTabBar:self.tabBarController.tabBar];
//here lays the trick - you change the size after you've called show
[actionSheet setBounds:CGRectMake(0,0,320, 480)];
//now create and add your image
UIImageView *subView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"exampleimage.png"]];
subView.ContentMode = UIViewContentModeScaleAspectFit;
subView.Frame = CGRectMake(0,130,320,180);//adjust these, so that your text fits in
[actionSheet addSubview: (subView)];
[subView release];
[actionSheet release];
actionSheet.actionSheetStyle = UIActionSheetStyleAutomatic;
actionSheet.title = @"some text";//here type your information text
actionSheet.delegate = self;
[actionSheet addButtonWithTitle:@"Button 1"];
[actionSheet addButtonWithTitle:@"Button 2"];
[actionSheet setCancelButtonIndex:1];
//it is up to you how you show it, I like the tabbar
[actionSheet showFromTabBar:self.tabBarController.tabBar];
//here lays the trick - you change the size after you've called show
[actionSheet setBounds:CGRectMake(0,0,320, 480)];
//now create and add your image
UIImageView *subView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"exampleimage.png"]];
subView.ContentMode = UIViewContentModeScaleAspectFit;
subView.Frame = CGRectMake(0,130,320,180);//adjust these, so that your text fits in
[actionSheet addSubview: (subView)];
[subView release];
[actionSheet release];
UIActionSheet UIActionSheetStyleAutomatic example.
-(void)ctnPhotoSelection
{
isMyCtView = YES;
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@""
delegate:self cancelButtonTitle:nil destructiveButtonTitle:nil
otherButtonTitles:@"Take Photo With Camera", @"Select Photo From Library", @"Cancel", nil];
actionSheet.actionSheetStyle = UIActionSheetStyleAutomatic;
actionSheet.destructiveButtonIndex = 1;
[actionSheet showInView:self.view];
[actionSheet release];
}
{
isMyCtView = YES;
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@""
delegate:self cancelButtonTitle:nil destructiveButtonTitle:nil
otherButtonTitles:@"Take Photo With Camera", @"Select Photo From Library", @"Cancel", nil];
actionSheet.actionSheetStyle = UIActionSheetStyleAutomatic;
actionSheet.destructiveButtonIndex = 1;
[actionSheet showInView:self.view];
[actionSheet release];
}
End of UIActionSheet UIActionSheetStyleAutomatic example article.