Home > Xcode solutions > How to create modal screen with save, email, share on facebook ?

How to create modal screen with save, email, share on facebook ?

October 16th, 2010 Leave a comment Go to comments


I want to add to my application new view with buttons for sharing content or saving it to disk. I know how to do sharing itself (save, email), but I wonder if this layer should be created as frame or there is any ready-to-use class displaying modal layer for half screen?

As I already know the answer, and it was much easier than I expected, I will share it here. Most programmers will probably find it in Human Interface Guidelines, but I started reading documentation from another documents, which was probably wrong order.

So, the answer is:

UIActionSheet *sheet = [[UIActionSheet alloc]
initWithTitle:@"My Title"
delegate:self
cancelButtonTitle:@"Cancel"
destructiveButtonTitle:@"Go"
otherButtonTitles:@"Remind me Later",nil];


- (void)actionSheet:(UIActionSheet *)menu 
didDismissWithButtonIndex:(NSInteger)buttonIndex {

    switch (buttonIndex) {
        case 0:
            //do something
            break;
        case 1:
            //do something else
            break;
        default:
            break;
    }
}

Tags:
  1. No comments yet.
  1. No trackbacks yet.


× 6 = eighteen