iPhone应用程序操作按钮 [英] iPhone app Action Button

查看:200
本文介绍了iPhone应用程序操作按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要在我的iPhone应用程序中添加动作按钮。当一个被点击UIActionSheet与按钮需要被弹出。
任何一个可以告诉我如何添加一个动作按钮? - 意味着是有iPhone应用程序的任何内置动作按钮?还是我们需要用图像创建一个新的按钮?

I need to add an action button in my iPhone application. When that one is clicked the UIActionSheet with buttons need to be popped up. Can any one tell me how to add an action button? - means is there any in built action button for iPhone app? or do we need to create a new button with image?

在此先感谢!

推荐答案

假设这是一个视图控制器,你可以这样做:

Assuming this is in a 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];
}

(原谅奇怪的缩进,使之适合在一个合理的宽度(我通常只是自动设X code包缩进一切))。

(Pardon the weird indentation to make it fit in a reasonable width (I normally just let Xcode wrap-indent everything automatically)).

请参阅尼克Veys如何实施答案 methodThatShowsSheet

See Nick Veys' answer for how to implement methodThatShowsSheet.

这篇关于iPhone应用程序操作按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆