Question

My objective here is to recreate this option view that Facebook messenger and many other apps use when they are displaying options.enter image description here

What is the best way to go about doing this? Is there a built in class that will let me do this? Are there good third party apps that will accomplish this task?

Was it helpful?

Solution

So after doing some digging what you need is an action sheet. Action sheets are pretty straight forward, to set an action sheet up:

UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:nil
                                                     delegate:self
                                            cancelButtonTitle:@"Cancel"
                                       destructiveButtonTitle:@"Delete Note"
                                            otherButtonTitles:nil];

To Collect Response

- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex{
    NSLog(@"The %@ button was tapped.", [actionSheet buttonTitleAtIndex:buttonIndex]);
}

More info: https://developer.apple.com/library/ios/documentation/userexperience/conceptual/UIKitUICatalog/UIActionSheet.html#//apple_ref/doc/uid/TP40012857-UIActionSheet

Extra:

Here is an open source modal framework: https://github.com/reednj/TDSemiModal

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top