一款自定义的AlertView
CocoaPods is a dependency manager for Objective-C, which automates and simplifies the process of using 3rd-party libraries. You can install it with the following command:
$ gem install cocoapods
To integrate KMAlertView into your Xcode project using CocoaPods, specify it in your Podfile
:
In your Podfile
pod 'KMAlertView'
Then, run the following command:
$ pod install
This library requires iOS 8.0+
///Title only
[KMAlertView showAlertWithTitle:@"Title only"];
///Message only
[KMAlertView showAlertWithMessage:@"Message only"];
///Title & Message & CallBackBlock
[KMAlertView showAlertWithTitle:self.shortTitle message:self.shortMessage callBackBlock:^(NSInteger buttonIndex, NSString *buttonTitle) {
}];
///Title & Message & ButtonTitles & CallBackBlock
[KMAlertView showAlertWithTitle:@"Title" message:@"Message" buttonTitles:@[@"button1", @"button2"] callBackBlock:^(NSInteger buttonIndex, NSString *buttonTitle) {
}];
///Setting With StyleConfigBlock
[KMAlertView showAlertWithStyleConfigBlock:^KMAlertStyle *(KMAlertStyle *alertStyle) {
return [KMAlertStyle new];
} callBackBlock:^(NSInteger buttonIndex, NSString *buttonTitle) {
}];
///ButtonTitles & StyleConfigBlock
[KMAlertView showAlertWithButtonTitles:@[@"button1", @"button2"] styleConfigBlock:^KMAlertStyle *(KMAlertStyle *alertStyle) {
return [KMAlertStyle new];
} callBackBlock:^(NSInteger buttonIndex, NSString *buttonTitle) {
}];
///AlertView Dismiss
[alertView dismissWithCompletion:^{
}];
hkm5558, SZHuangKM@163.com
KMAlertView is available under the MIT license. See the LICENSE file for more info.