Created
September 9, 2013 07:27
-
-
Save firecall/6492454 to your computer and use it in GitHub Desktop.
Create a UIActionSheet from an NSArray
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| self.myActionSheet = [[UIActionSheet alloc] initWithTitle:@"Select Something" delegate:self cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles:nil, nil]; | |
| //self.myArray could be an array of CoreData objects | |
| for (id myObject in self.myArray) { | |
| [self.myActionSheet addButtonWithTitle:myObject.aString]; | |
| } | |
| [self.myActionSheet addButtonWithTitle:@"Cancel"]; | |
| self.myActionSheet.cancelButtonIndex = [self.myActionSheet count]; | |
| [self.myActionSheet showInView:[self.view superview]]; | |
| self.myActionSheet.actionSheetStyle = UIActionSheetStyleBlackOpaque; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment