UIAlertView的簡單用法

UIAlertView是系統爲我們封裝好的一個提示框,會彈出在屏幕的中間位置,有可選擇的按鈕,我們只需要創建它,並寫上提示內容就可以了,非常方便,(iOS8之後這個方法已經被棄用,用UIAlertController替代,

UIAlertController繼承與UIViewController,用於替代UIAlertViewUIActionSheet,iOS8之後纔有的

)

一,UIAlertView簡單用法

UIAlertView *alter = [[UIAlertView alloc] initWithTitle:@"提示" message:@"歡迎回來" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"確定", @"再來一次", @"哈哈", nil];

    alter.tag = 100;

    [alter addButtonWithTitle:@"12"];

      [alter show];

    [alter release];


當我們設置多個button的時候,取消的button總是在最後一個,其它的會按順序排列
發佈了45 篇原創文章 · 獲贊 2 · 訪問量 4萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章