UIActionSheet
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController<UIActionSheetDelegate>
{
UILabel *lable;
}
@end
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
UIButton *button2=[UIButton buttonWithType:UIButtonTypeCustom];
button2.backgroundColor=[UIColor greenColor];
button2.frame=CGRectMake(100, 200, 120, 50);
[button2 addTarget:self action:@selector(showmyActionSheet:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:button2];
}
-(void)showmyActionSheet:(UIButton *)sender
{
UIActionSheet *actionSheet1=[[UIActionSheet alloc]initWithTitle:@"ActionSheet" delegate:self cancelButtonTitle:@"取消" destructiveButtonTitle:@"red color" otherButtonTitles:@"blue color",@"black color", nil];
NSLog(@"%@",[actionSheet1 buttonTitleAtIndex:0]);
[actionSheet1 showInView:self.view];
}
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
if (buttonIndex==0) {
self.view.backgroundColor=[UIColor redColor];
}
else if (buttonIndex==1){
self.view.backgroundColor=[UIColor blueColor];
}
else if (buttonIndex==2)
{
self.view.backgroundColor=[UIColor blackColor];
}
}
//ActionSheet已经消失的方法
- (void)actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex
{
lable.text=@"已经消失";
}
//
- (void)actionSheetCancel:(UIActionSheet *)actionSheet{
lable.text=@"zheshism";
}
//将要出现
- (void)willPresentActionSheet:(UIActionSheet *)actionSheet{
lable.text=@"将要出现";
}
//已经出现
- (void)didPresentActionSheet:(UIActionSheet *)actionSheet{
lable.text=@"已经出现";
}
//将要消失
- (void)actionSheet:(UIActionSheet *)actionSheet willDismissWithButtonIndex:(NSInteger)buttonIndex{
lable.text=@"将要消失";
}
UIActionSheet的更多相关文章
- 弹框控件 UIAlertView UIActionSheet
// 创建弹框 从底部弹出,一般用于危险操作 UIActionSheet *sheet = [[UIActionSheet alloc] initWithTitle:@"恭喜通关" ...
- UI第十三节——UIActionSheet
- (void)viewDidLoad { [super viewDidLoad]; UISwitch *swc = [[UISwitch alloc] initWithFrame ...
- 【代码笔记】iOS-清除图片缓存UIActionSheet
一,效果图. 二,代码. RootViewController.m //点击任何处出现sheet -(void)touchesBegan:(NSSet *)touches withEvent:(UIE ...
- UIAlertView 与 UIActionSheet (提示用户)的使用方法
UIAlertView 提示用户 帮助用户选择框 // UIAlertView *alterView = [[UIAlertView alloc] initWithTitle:@"警 ...
- UI里的UIActionSheet按钮
1.效果图:分别为有短信分享 无短信分享 -(void)viewDidLoad{ //添加按钮 UIButton *share ...
- UIActionSheet的使用
UIActionSheet是在iOS弹出的选择按钮项,可以添加多项,并为每项添加点击事件. 为了快速完成这例子,我们打开Xcode 4.3.2, 先建立一个single view applicatio ...
- UIAlertView、 UIActionSheet
一.UIAlertView. UIActionSheet都是ios系统自带的弹出式对话框,当UIAlertView或UIActionSheet弹出来时用户无法与应用界面中的其它控件交互,UIAlert ...
- IOS笔记之UIKit_UIAlertView、UIActionSheet
//首先必须继承协议 @interface TRViewController : UIViewController<UIAlertViewDelegate,UIActionSheetDelega ...
- UIActionSheet 修改字体颜色
-(void)willPresentActionSheet:(UIActionSheet *)actionSheet { SEL selector = NSSelectorFromString(@&q ...
- 封装同步的UIActionSheet
封装同步的UIActionSheet 发问题 做 iOS 开发的同学想必都用过 UIActionSheet.UIActionSheet 可以弹出一个选择列表,让用户选择列表中的某一项操作.使用 UIA ...
随机推荐
- 自增锁预分配ID
http://www.cnblogs.com/xpchild/p/3825309.html mysql> show create table pp; CREATE TABLE `pp` ( `i ...
- 关于BP算法在DNN中本质问题的几点随笔 [原创 by 白明] 微信号matthew-bai
随着deep learning的火爆,神经网络(NN)被大家广泛研究使用.但是大部分RD对BP在NN中本质不甚清楚,对于为什这么使用以及国外大牛们是什么原因会想到用dropout/sigmoid ...
- BootStrap2学习日记14----导航
<div class="navbar navbar-inverse navbar-fixed-top"> <div class="navbar-inne ...
- Traveling by Stagecoach 状态压缩裸题
Traveling by Stagecoach dp[s][v] 从源点到达 v,状态为s,v的最小值. for循环枚举就行了. #include <iostream> #inclu ...
- 1.4.2 solr字段类型--(1.4.2.3)使用货币和汇率
1.4.2 solr字段类型 (1.4.2.1) 字段类型定义和字段类型属性. (1.4.2.2) solr附带的字段类型 (1.4.2.3) 使用货币和汇率 (1.4.2.4) 使用Dates(日期 ...
- Java SortedSet接口
该SortedSet的接口扩展集Set并声明了一组按升序排序的行为.除了通过集定义的那些方法中,SortedSet接口声明总结于下表的方法: 有几种方法没有任何条目包含在调用Set的时候抛出一个NoS ...
- FormsAuthenticationTicket学习笔记
FormsAuthenticationTicket ticket = , ), true, string.Format("{0}:{1}", "username" ...
- 【Python千问 2】Python核心编程(第二版)-- 欢迎来到Python世界
1.1 什么是Python 继承了传统编译语言的强大性和通用性,同时也借鉴了简单脚本和解释语言的易用性. 1.2 起源 来源于某个项目,那些程序员利用手边现有的工具辛苦工作着,他们设想并开发了更好的解 ...
- 【Android 界面效果35】管理Fragments
http://www.cnblogs.com/mengdd/archive/2013/01/09/2853254.html
- flexpaper 在线观看 PPT,PDF,DOC等文档
0.安装环境.可以参考http://www.cnblogs.com/star-studio/archive/2011/12/09/2281807.html 百度关键字 仿百度文库方案 1.借用 ...