IPhone Action Button

I need to add an action button in an iPhone application. When this click is clicked, a message appears with the UIActionSheet number with buttons. Can someone tell me how to add an action button? - is there a built-in button for the iPhone for the application? or do we need to create a new button with an image?

Thanks in advance!

+2
source share
3 answers

Assuming this is in the view controller, you can do something like:

- (void)viewDidLoad { UIBarButtonItem *actionButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction target:self action:@selector(methodThatShowsSheet)]; self.navigationItem.rightBarButtonItem = actionButton; [actionButton release]; } 

(Forgive the weird indentation to fit a reasonable width (I usually just let Xcode wrap everything in a row)).

See Nick Weiss answer on how to implement methodThatShowsSheet .

+2
source

You need to connect the action using the button that you have decided, present this action bar for the code that shows it.

Refer to the Apple Documentation on the UIActionSheet page for help on this.

+1
source

I'm not sure I understand your question, but UIKit includes a UIButton class that will automatically send a message (specified by you) to an object (also specified by you). You can create a UIButton i nInterface builder or programmatically.

Without any details about what you really want to do or why it is difficult for you, it is difficult to be more precise.

0
source

All Articles