iphone通过UIActionSheetDelegate实现警告
2012-04-12 09:44
309 查看
iphone通过UIActionSheetDelegate实现警告
原文地址:http://wangjun.easymorse.com/?p=966在iphone程序中有一些操作需要提醒用户确实要进行,确保用户因手误删除重要数据,下面是一种警告窗口:
实现发放很简单:
在相应的controller的.h中添加UIActionSheetDelegate协议。如:
@interface Stage5ViewController : UIViewController
<UIActionSheetDelegate>
在.m中添加相应的方法即可:
-(IBAction) showActionSheetButtonPressed:(id) sender
{
UIActionSheet *actionSheet = [[UIActionSheet alloc]
initWithTitle:@”Congratulation. You have completed the elimination diet and food challenge test. Do you want to share your progress with friends?”
delegate:self
cancelButtonTitle:@”Cancel”
destructiveButtonTitle:nil
otherButtonTitles:@”Facebook”,@”Twitter”,nil ];
[actionSheet showInView:self.view];//参数指显示UIActionSheet的parent。
[actionSheet release];
}
-(void) actionSheet : (UIActionSheet *) actionSheet didDismissWithButtonIndex:(NSInteger) buttonIndex
{
switch (buttonIndex) {
case 0:
NSLog(@”facebook”);
break;
case 1:
NSLog(@”twitter”);
break;
default:
break;
}
}
在相应的函数中调用showActionSheetButtonPressed即可。
相关文章推荐
- iphone通过UIActionSheetDelegate实现警告
- iphone通过UIActionSheetDelegate实现警告
- iPhone开发--UIActionSheet设置delegate为self时出现警告
- UIActionSheet设置delegate为self时出现警告
- iphone开发 UIActionSheet(操作表) 和UIAlertView(警告)的用法
- UIActinSheet和UIActionSheetDelegate
- iPhone开发之动态添加UIActionSheet按钮
- IOS学习笔记(九)之UIAlertView(警告视图)和UIActionSheet(操作表视图)基本概念和使用方法
- iPhone开发——通过代码自定义cell实现qq聊天界面
- iphone 弹出表单UIActionSheet的应用。
- iphone--通过UIView实现动画效果
- iPhone起步-2:iPhone常用控件、UIActionSheet、UIAlertView (转)
- IOS学习笔记(九)之UIAlertView(警告视图)和UIActionSheet(操作表视图)基本概念和使用方法
- iOS8以后UIAlertView和UIActionSheet两种alert页面都将通过UIAlertController来创建
- iPhone消息推送机制(Push)实现及通过.net应用程序发送消息给ios应用程序
- iPhone开发之UIActionSheet
- iPhone开发之UIActionSheet
- 越狱的 iPhone、iPad 通过网站实现一键安装 ipa 格式的 APP 应用