日本搞逼视频_黄色一级片免费在线观看_色99久久_性明星video另类hd_欧美77_综合在线视频

國內最全IT社區平臺 聯系我們 | 收藏本站
阿里云優惠2
您當前位置:首頁 > php開源 > 綜合技術 > iOS控件之UIAlertView

iOS控件之UIAlertView

來源:程序員人生   發布時間:2016-07-29 16:25:08 閱讀次數:2569次

UIAlertView就是我們常說的正告視圖 

作用:提示用戶,幫助用戶選擇


在IOS中主要有2種情勢   1.是alert正告 彈出帶有震動效果 主要是給用戶1個通知
                    2.是ActionSheet 會在屏幕底部滑出 相當于產生1個占屏幕1/3大小的view
                         可以通過該窗口將信息發布到如 微薄  人人等資源上




ActionSheet和AlertView 比較相似都是給用戶1個提示信息。它是從底部彈出。它通經常使用于確認潛 
在的危險或不能撤銷的操作,如刪除1個數據。  


iOS程序中的Action Sheet就像Windows中的 “肯定-取消”對話框1樣,用于強迫用戶進行選擇。當用戶將要進行的操作具有1定危險時,常常使用Action Sheet對用戶進行危險提示,這樣,用戶有機會進行取消操作。
 




Action Sheet需要多個參數:
(1)initWithTitle:設置標題,將會顯示在Action Sheet的頂部
(2)delegate:設置Action Sheet的拜托。當Action Sheet的1個按鈕被按下后,它的delegate將會被通知,并且會履行這個delegate的actionSheet: didDismissWithButtonIndex方法將會履行。這里,我們將delegate設成self,這樣可以保證履行我們自己在ViewController.m寫的actionSheet: didDismissWithButtonIndex方法
(3)cancelButtonTitle:設置取消按鈕的標題,這個取消按鈕將會顯示在Action Sheet的最下邊
(4)destructiveButtonTitle:設置第1個肯定按鈕的標題,這個按鈕可以理解成:"好的,繼續"
(5)otherButtonTitles:可以設置任意多的肯定按鈕






Alert相當于Windows中的Messagebox,跟Action Sheet也是類似的。不同的是,Alert可以只有1個選擇項,而Action Sheet卻最少要兩個選項。


Alert也要填寫很多參數:
 
(1)initWithTitle:設置標題,將會顯示在Alert的頂部
(2)message:設置提示消息內容
(3)delegate:設置Alert的拜托。這里,我們設成self
(4)cancelButtonTitle:設置取消按鈕的標題
(5)otherButtonTitles:與Action Sheet類似
[alert show]這條語句用來顯示Alert。



project: UIAlertOrSheetDemo  


new file ...


              name:AlertView
              superclass:UIAlertView


打開  AlertView.m


加入


- (void)dealloc
{
//    NSLog(@"dead : %d", self.tag);
    [super dealloc];
}








打開 AppDelegate.m


加入


#import "AlertView.h"






在  - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions


中的    [self.window makeKeyAndVisible];  頂上加入






    UIButton *button1 = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    button1.frame = CGRectMake(10, 100, 140, 40);
    [button1 setTitle:@"alertView" forState:UIControlStateNormal];
    [button1 addTarget:self action:@selector(showAlertView) forControlEvents:UIControlEventTouchUpInside];
    [self.window addSubview:button1];
    
    UIButton *button2 = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    button2.frame = CGRectMake(240⑺0, 100, 140, 40);
    [button2 setTitle:@"actionSheet" forState:UIControlStateNormal];
    [button2 addTarget:self action:@selector(showActionView) forControlEvents:UIControlEventTouchUpInside];
    [self.window addSubview:button2];






在加入方法






- (void)showAlertView
{                  //第1個是取消按鈕 以后是肯定按鈕
    UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"title" message:@"message" delegate:nil cancelButtonTitle:@"cancel" otherButtonTitles:@"other1", @"other2", nil] ;
    [alertView show];
    
}


- (void)showActionView
{
    UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"title" delegate:self cancelButtonTitle:@"cancel" destructiveButtonTitle:@"destructive" otherButtonTitles:@"other1", @"other2", @"other3", @"other3", nil] ;
    [actionSheet showInView:self.window];
}

生活不易,碼農辛苦
如果您覺得本網站對您的學習有所幫助,可以手機掃描二維碼進行捐贈
程序員人生
------分隔線----------------------------
分享到:
------分隔線----------------------------
關閉
程序員人生
主站蜘蛛池模板: 在线观看中文字幕 | 欧美性受xxxx黑人xyx性爽 | 成人精品影院 | 久久久精品影院 | 老色网站 | 色婷婷综合久久久 | 久久大 | 国产精品video | 国产在线播放不卡 | 日韩精品一区二区三区在线 | 欧美日韩综合久久久 | 亚洲一区二区三区精品在线 | 欧美a区| 欧美日韩在线视频一区二区三区 | 日本久久中文字幕 | 国产伦精品一区二区三区免 | 日韩免费| 国产又爽又黄免费视频 | 久久精品视频网站 | 日韩欧美高清在线 | 亚洲欧洲网站 | 国产精品国产三级国产aⅴ9色 | 91网页入口 | 91婷婷射 | 精品一区二区三区日产乱码 | 日韩视频一区 | 亚洲国产精品一区二区第一页 | 亚洲一区二区黄 | 欧美3级| 日韩av在线看| a v视频在线播放 | 国产第二区 | 视频一区在线 | 午夜精品在线观看 | 国产中文一区二区三区 | 欧美日韩亚洲一区 | 麻豆国产一区二区三区四区 | 国产精品第四页 | 正在播放国产一区 | 黄色毛片一级片 | 免费在线成人 |