Alert
效果 | 效果 |
---|---|
![]() |
![]() |
消息提醒視圖,在Xcode7 ,iOS9.0的SDK中,已經明確提示不再推薦使用UIAlertView,而只能使用UIAlertController; 而系統的樣式不能夠滿足大多UI的需求,因此自定義一個類似UIAlertView;
使用:
pod 'Alert', '~> 1.0.3'
#import "Alert.h"
Alert *alert = [[Alert alloc] initWithTitle:CLocalizedString(@"輸入口令") message:nil
delegate:nil
cancelButtonTitle:CLocalizedString(@"取消")
otherButtonTitles:CLocalizedString(@"進入"), nil];
alert.alertStyle = AlertStylePlainTextInput;
__block Alert*alertV = alert;
[alert setClickBlock:^(Alert *alertView, NSInteger buttonIndex) {
if (buttonIndex == 1) {
NSLog(@"%@", alertV.textField.text);
}
}];
[alert setCancelBlock:^(Alert *alertView) {
// 取消
}];
[alert show];
| 

|: -------------: |:-------------:|
|


|


|


|


|


|

