Lite framework with some helpful categories over UIKit classes.
+ml_actionSheetWithTitle:style:destructiveButtonTitle:otherButtonTitles:cancelButtonTitle:destructiveBlock:dismissBlock:cancelBlock:
Creates an alert view using convenient blocks for the confirmation and cancellation actions.
Example:
[[UIActionSheet
ml_actionSheetWithTitle:@"Do something!"
style:UIActionSheetStyleDefault
destructiveButtonTitle:@"Destroy!"
otherButtonTitles:@[@"Button Zero", @"Button One"]
cancelButtonTitle:@"Cancel"
destructiveBlock:^(UIActionSheet *actionSheet) {
// Do something destructive...
}
dismissBlock:^(UIActionSheet *actionSheet, NSInteger buttonIx) {
switch (buttonIx)
{
case 0:
// Action for button Zero
break;
case 1:
// Action for button One
break;
}
}
cancelBlock:^(UIActionSheet *actionSheet) {
// Do something on the cancel...
}] showInView:view];
+ (UIActionSheet *)ml_actionSheetWithTitle:(NSString *)title
style:(UIActionSheetStyle)style
destructiveButtonTitle:(NSString *)destructiveButtonTitle
otherButtonTitles:(NSArray *)otherButtonTitles
cancelButtonTitle:(NSString *)cancelButtonTitle
destructiveBlock:(MLActionSheetDestructiveBlock)destructiveBlock
dismissBlock:(MLActionSheetDismissBlock)dismissBlock
cancelBlock:(MLActionSheetCancelBlock)cancelBlock
The title of the action sheet.
See UIActionSheetStyle
for more details.
The tirle of the destructive button. Can be nil
if there is no cancel button.
The title of the confirmation button. Can be nil
if there is no confirmation button.
The title of the cancel button. Can be nil
if there is no cancel button.
The block for the destructive action. Ignored if nil
.
The block to be executed when a button other than the destructive or cancel ones is tapped. Ignored if nil
.
- cancelBlock
The block for the cancel action. Ignored if
nil
.
The new alert view that can be shown.
Creates an alert view using convenient blocks for the confirmation and cancellation actions.
Example:
[[UIAlertView
ml_alertViewWithTitle:@"Are you sure?"
message:@"Something will happen if you continue"
confirmButton:@"Continue"
cancelButton:@"Never mind"
confirmBlock:^{
// Do something...
}
cancelBlock:^{
// Cancel it...
}] show];
+ (UIAlertView *)ml_alertViewWithTitle:(NSString *)title
message:(NSString *)message
confirmButtonTitle:(NSString *)confirmButtonTitle
cancelButtonTitle:(NSString *)cancelButtonTitle
confirmBlock:(MLUIAlertViewBlock)confirmBlock
cancelBlock:(MLUIAlertViewBlock)cancelBlock
The title of the alert view.
The text message in the alert view.
The title of the confirmation button in the alert view. Can be nil if there is no confirmation button.
The title of the cancel button in the alert view. Can be nil if there is no cancel button.
The block for the confirmation action. Ignored if nil
.
The block for the cancel action. Ignored if nil
.
The new alert view that can be shown.
Creates a UIColor
instance with the RGB color values provided as an integer
.
Example:
UIColor *red = [UIColor ml_colorForRGBHex:0xFF0000];
+ (UIColor *)ml_colorForRGBHex:(UInt32)hex
A hexadecimal number encoding the RGB values.
A UIColor
instance with the given RGB values.
Creates a UIColor
instance with the RGB color values provided as a string
. You know designers love to give you hex values!
Example:
UIColor *red = [UIColor ml_colorForRGBHexString:@"FF0000"];
+ (UIColor *)ml_colorForRGBHexString:(NSString *)string
A hexadecimal number represented in a string, just as you would get on HTML or CSS.
A UIColor
instance with the given RGB values.