iOS programming in 2010

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

Posted: October 16th, 2010 | Author: | Filed under: Xcode solutions | Comments Off on How to create modal screen with save, email, share on facebook ?


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;
    }
}


Comments are closed.