KVAlertView Class Reference
| Inherits from | UIAlertView |
| Declared in | KVAlertView.h KVAlertView.m |
Overview
This subclass of UIAlertView adds support for blocks.
Sample usage:
KVAlertView *alert = [KVAlertView alertWithTitle:NSLocalizedString(@"Title", @"")
message:NSLocalizedString(@"Message", @"")
cancelButtonTitle:NSLocalizedString(@"Cancel", @"")
cancelBlock:^(KVAlertView *alertView){
NSLog(@"Cancel");
}];
alert.alertViewStyle = UIAlertViewStylePlainTextInput;
[alert addButtonWithTitle:NSLocalizedString(@"OK", @"") block:^(KVAlertView *alertView){
NSLog(@"OK: %@", [alertView textFieldAtIndex:0].text);
}];
[alert show];
Tasks
Creating alert
-
+ alertWithTitle:message:cancelButtonTitle:cancelBlock:Create an alert
-
+ alertWithTitle:message:cancelButtonTitle:cancelBlock:confirmButtonTitle:confirmBlock:Create an alert
-
+ showWithTitle:message:cancelButtonTitle:cancelBlock:Create and immediately show an alert
-
+ showWithTitle:message:cancelButtonTitle:cancelBlock:confirmButtonTitle:confirmBlock:Create and immediately show an alert
Customizing alert
-
– addButtonWithTitle:block:Add a button to the alert
Class Methods
alertWithTitle:message:cancelButtonTitle:cancelBlock:
Create an alert
+ (KVAlertView *)alertWithTitle:(NSString *)title message:(NSString *)message cancelButtonTitle:(NSString *)cancelButtonTitle cancelBlock:(KVAlertViewBlock)cancelBlockParameters
- title
Title in alert
- message
Message in alert
- cancelButtonTitle
Title of Cancel button in alert
- cancelBlock
Block to execute when Cancel button is pressed
Return Value
Instance of KVAlertView
Discussion
Create an alert
Declared In
KVAlertView.halertWithTitle:message:cancelButtonTitle:cancelBlock:confirmButtonTitle:confirmBlock:
Create an alert
+ (KVAlertView *)alertWithTitle:(NSString *)title message:(NSString *)message cancelButtonTitle:(NSString *)cancelButtonTitle cancelBlock:(KVAlertViewBlock)cancelBlock confirmButtonTitle:(NSString *)confirmButtonTitle confirmBlock:(KVAlertViewBlock)confirmBlockParameters
- title
Title in alert
- message
Message in alert
- cancelButtonTitle
Title of Cancel button in alert
- cancelBlock
Block to execute when Cancel button is pressed
- confirmButtonTitle
Title of Confirm (OK) button in alert
- confirmBlock
Block to execute when Confirm button is pressed
Return Value
Instance of KVAlertView
Discussion
Create an alert
Declared In
KVAlertView.hshowWithTitle:message:cancelButtonTitle:cancelBlock:
Create and immediately show an alert
+ (void)showWithTitle:(NSString *)title message:(NSString *)message cancelButtonTitle:(NSString *)cancelButtonTitle cancelBlock:(KVAlertViewBlock)cancelBlockParameters
- title
Title in alert
- message
Message in alert
- cancelButtonTitle
Title of Cancel button in alert
- cancelBlock
Block to execute when Cancel button is pressed
Discussion
Create and immediately show an alert
Declared In
KVAlertView.hshowWithTitle:message:cancelButtonTitle:cancelBlock:confirmButtonTitle:confirmBlock:
Create and immediately show an alert
+ (void)showWithTitle:(NSString *)title message:(NSString *)message cancelButtonTitle:(NSString *)cancelButtonTitle cancelBlock:(KVAlertViewBlock)cancelBlock confirmButtonTitle:(NSString *)confirmButtonTitle confirmBlock:(KVAlertViewBlock)confirmBlockParameters
- title
Title in alert
- message
Message in alert
- cancelButtonTitle
Title of Cancel button in alert
- cancelBlock
Block to execute when Cancel button is pressed
- confirmButtonTitle
Title of Confirm (OK) button in alert
- confirmBlock
Block to execute when Confirm button is pressed
Discussion
Create and immediately show an alert
Declared In
KVAlertView.hInstance Methods
addButtonWithTitle:block:
Add a button to the alert
- (NSInteger)addButtonWithTitle:(NSString *)title block:(KVAlertViewBlock)blockParameters
- title
Title of button
- block
Block to execute when button is pressed
Return Value
Index of added button
Discussion
Add a button to the alert
Declared In
KVAlertView.h