Skip to content

Commit

Permalink
Fixed some bugs, added new features
Browse files Browse the repository at this point in the history
  • Loading branch information
Admin authored and Admin committed Nov 3, 2015
1 parent 1cc440f commit 2135bc6
Show file tree
Hide file tree
Showing 9 changed files with 475 additions and 401 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,5 @@ Pods/
._*

.hgignore

.DS_Store
23 changes: 21 additions & 2 deletions Demo/LGAlertViewDemo/TableViewControllerActionSheet.m
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ - (id)init
@"LGAlertView + A lot of buttons short",
@"LGAlertView + UIView",
@"LGAlertView + ActivityIndicator",
@"LGAlertView + ProgressView"];
@"LGAlertView + ActivityIndicator cancel",
@"LGAlertView + ProgressView cancel"];

[self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"cell"];
UIEdgeInsets contentInset = self.tableView.contentInset;
Expand Down Expand Up @@ -261,7 +262,7 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
message:@"Waiting please"
style:LGAlertViewStyleActionSheet
buttonTitles:nil
cancelButtonTitle:@"I'm hurry"
cancelButtonTitle:nil
destructiveButtonTitle:nil
actionHandler:nil
cancelHandler:nil
Expand All @@ -274,6 +275,24 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
});
}
else if (indexPath.row == 11)
{
LGAlertView *alertView = [[LGAlertView alloc] initWithActivityIndicatorAndTitle:@"Loading"
message:@"Waiting please"
style:LGAlertViewStyleActionSheet
buttonTitles:nil
cancelButtonTitle:@"I'm hurry"
destructiveButtonTitle:nil
actionHandler:nil
cancelHandler:nil
destructiveHandler:nil];
[alertView showAnimated:YES completionHandler:nil];

dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(5.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^(void)
{
[alertView dismissAnimated:YES completionHandler:nil];
});
}
else if (indexPath.row == 12)
{
LGAlertView *alertView = [[LGAlertView alloc] initWithProgressViewAndTitle:@"Loading"
message:@"Waiting please"
Expand Down
25 changes: 22 additions & 3 deletions Demo/LGAlertViewDemo/TableViewControllerAlert.m
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ - (id)init
@"LGAlertView + A lot of textFields",
@"LGAlertView + UIView",
@"LGAlertView + ActivityIndicator",
@"LGAlertView + ProgressView"];
@"LGAlertView + ActivityIndicator cancel",
@"LGAlertView + ProgressView cancel"];

[self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"cell"];
UIEdgeInsets contentInset = self.tableView.contentInset;
Expand Down Expand Up @@ -317,7 +318,7 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
numberOfTextFields:25
textFieldsSetupHandler:^(UITextField *textField, NSUInteger index)
{
textField.placeholder = [NSString stringWithFormat:@"Placeholder %lu", index+1];
textField.placeholder = [NSString stringWithFormat:@"Placeholder %lu", (long unsigned)index+1];
}
buttonTitles:@[@"Done"]
cancelButtonTitle:@"Cancel"
Expand Down Expand Up @@ -351,7 +352,7 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
message:@"Waiting please"
style:LGAlertViewStyleAlert
buttonTitles:nil
cancelButtonTitle:@"I'm hurry"
cancelButtonTitle:nil
destructiveButtonTitle:nil
actionHandler:nil
cancelHandler:nil
Expand All @@ -364,6 +365,24 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
});
}
else if (indexPath.row == 16)
{
LGAlertView *alertView = [[LGAlertView alloc] initWithActivityIndicatorAndTitle:@"Loading"
message:@"Waiting please"
style:LGAlertViewStyleAlert
buttonTitles:nil
cancelButtonTitle:@"I'm hurry"
destructiveButtonTitle:nil
actionHandler:nil
cancelHandler:nil
destructiveHandler:nil];
[alertView showAnimated:YES completionHandler:nil];

dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(5.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^(void)
{
[alertView dismissAnimated:YES completionHandler:nil];
});
}
else if (indexPath.row == 17)
{
LGAlertView *alertView = [[LGAlertView alloc] initWithProgressViewAndTitle:@"Loading"
message:@"Waiting please"
Expand Down
3 changes: 3 additions & 0 deletions Demo/LGAlertViewDemo/TableViewControllerCustomAlert.m
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
alertView.width = MIN(self.view.bounds.size.width, self.view.bounds.size.height);
alertView.titleTextAlignment = NSTextAlignmentLeft;
alertView.messageTextAlignment = NSTextAlignmentLeft;
alertView.oneRowOneButton = YES;
alertView.buttonsTextAlignment = NSTextAlignmentRight;
alertView.cancelButtonTextAlignment = NSTextAlignmentRight;
alertView.destructiveButtonTextAlignment = NSTextAlignmentRight;
Expand Down Expand Up @@ -194,6 +195,7 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
alertView.width = MIN(self.view.bounds.size.width, self.view.bounds.size.height);
alertView.titleTextAlignment = NSTextAlignmentLeft;
alertView.messageTextAlignment = NSTextAlignmentLeft;
alertView.oneRowOneButton = YES;
alertView.destructiveButtonTextAlignment = NSTextAlignmentRight;
alertView.buttonsTextAlignment = NSTextAlignmentRight;
alertView.cancelButtonTextAlignment = NSTextAlignmentRight;
Expand Down Expand Up @@ -222,6 +224,7 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
alertView.width = MIN(self.view.bounds.size.width, self.view.bounds.size.height);
alertView.titleTextAlignment = NSTextAlignmentLeft;
alertView.messageTextAlignment = NSTextAlignmentLeft;
alertView.oneRowOneButton = YES;
alertView.destructiveButtonTextAlignment = NSTextAlignmentRight;
alertView.buttonsTextAlignment = NSTextAlignmentRight;
alertView.cancelButtonTextAlignment = NSTextAlignmentRight;
Expand Down
2 changes: 1 addition & 1 deletion Demo/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ EXTERNAL SOURCES:
:path: ../

SPEC CHECKSUMS:
LGAlertView: 859226b0f4bf097819e04b9ab309277d17aae324
LGAlertView: a70295bb08ecb940da71b6009b14199a3b580453

COCOAPODS: 0.39.0
Empty file modified Demo/podsInstall.command
100644 → 100755
Empty file.
Empty file modified Demo/podsUpdate.command
100644 → 100755
Empty file.
31 changes: 20 additions & 11 deletions LGAlertView/LGAlertView.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,9 @@ LGAlertViewWindowLevel;

@property (strong, nonatomic, readonly) NSMutableArray *textFieldsArray;

@property (assign, nonatomic, getter=isPadShowActionSheetFromBottom) BOOL padShowActionSheetFromBottom;
@property (assign, nonatomic, getter=isOneRowOneButton) BOOL oneRowOneButton;

/** Do not forget about weak referens to self */
@property (strong, nonatomic) void (^willShowHandler)(LGAlertView *alertView);
/** Do not forget about weak referens to self */
Expand All @@ -175,7 +178,7 @@ LGAlertViewWindowLevel;
/** Do not forget about weak referens to self */
@property (strong, nonatomic) void (^actionHandler)(LGAlertView *alertView, NSString *title, NSUInteger index);
/** Do not forget about weak referens to self */
@property (strong, nonatomic) void (^cancelHandler)(LGAlertView *alertView, BOOL onButton);
@property (strong, nonatomic) void (^cancelHandler)(LGAlertView *alertView);
/** Do not forget about weak referens to self */
@property (strong, nonatomic) void (^destructiveHandler)(LGAlertView *alertView);

Expand Down Expand Up @@ -267,7 +270,7 @@ LGAlertViewWindowLevel;
cancelButtonTitle:(NSString *)cancelButtonTitle
destructiveButtonTitle:(NSString *)destructiveButtonTitle
actionHandler:(void(^)(LGAlertView *alertView, NSString *title, NSUInteger index))actionHandler
cancelHandler:(void(^)(LGAlertView *alertView, BOOL onButton))cancelHandler
cancelHandler:(void(^)(LGAlertView *alertView))cancelHandler
destructiveHandler:(void(^)(LGAlertView *alertView))destructiveHandler;

/** Do not forget about weak referens to self for actionHandler, cancelHandler and destructiveHandler blocks */
Expand All @@ -279,7 +282,7 @@ LGAlertViewWindowLevel;
cancelButtonTitle:(NSString *)cancelButtonTitle
destructiveButtonTitle:(NSString *)destructiveButtonTitle
actionHandler:(void(^)(LGAlertView *alertView, NSString *title, NSUInteger index))actionHandler
cancelHandler:(void(^)(LGAlertView *alertView, BOOL onButton))cancelHandler
cancelHandler:(void(^)(LGAlertView *alertView))cancelHandler
destructiveHandler:(void(^)(LGAlertView *alertView))destructiveHandler;

/** Do not forget about weak referens to self for actionHandler, cancelHandler and destructiveHandler blocks */
Expand All @@ -290,7 +293,7 @@ LGAlertViewWindowLevel;
cancelButtonTitle:(NSString *)cancelButtonTitle
destructiveButtonTitle:(NSString *)destructiveButtonTitle
actionHandler:(void(^)(LGAlertView *alertView, NSString *title, NSUInteger index))actionHandler
cancelHandler:(void(^)(LGAlertView *alertView, BOOL onButton))cancelHandler
cancelHandler:(void(^)(LGAlertView *alertView))cancelHandler
destructiveHandler:(void(^)(LGAlertView *alertView))destructiveHandler;

/** Do not forget about weak referens to self for actionHandler, cancelHandler and destructiveHandler blocks */
Expand All @@ -302,7 +305,7 @@ LGAlertViewWindowLevel;
cancelButtonTitle:(NSString *)cancelButtonTitle
destructiveButtonTitle:(NSString *)destructiveButtonTitle
actionHandler:(void(^)(LGAlertView *alertView, NSString *title, NSUInteger index))actionHandler
cancelHandler:(void(^)(LGAlertView *alertView, BOOL onButton))cancelHandler
cancelHandler:(void(^)(LGAlertView *alertView))cancelHandler
destructiveHandler:(void(^)(LGAlertView *alertView))destructiveHandler;

/** Do not forget about weak referens to self for actionHandler, cancelHandler and destructiveHandler blocks */
Expand All @@ -314,7 +317,7 @@ LGAlertViewWindowLevel;
cancelButtonTitle:(NSString *)cancelButtonTitle
destructiveButtonTitle:(NSString *)destructiveButtonTitle
actionHandler:(void(^)(LGAlertView *alertView, NSString *title, NSUInteger index))actionHandler
cancelHandler:(void(^)(LGAlertView *alertView, BOOL onButton))cancelHandler
cancelHandler:(void(^)(LGAlertView *alertView))cancelHandler
destructiveHandler:(void(^)(LGAlertView *alertView))destructiveHandler;

/** Do not forget about weak referens to self for actionHandler, cancelHandler and destructiveHandler blocks */
Expand All @@ -325,7 +328,7 @@ LGAlertViewWindowLevel;
cancelButtonTitle:(NSString *)cancelButtonTitle
destructiveButtonTitle:(NSString *)destructiveButtonTitle
actionHandler:(void(^)(LGAlertView *alertView, NSString *title, NSUInteger index))actionHandler
cancelHandler:(void(^)(LGAlertView *alertView, BOOL onButton))cancelHandler
cancelHandler:(void(^)(LGAlertView *alertView))cancelHandler
destructiveHandler:(void(^)(LGAlertView *alertView))destructiveHandler;

/** Do not forget about weak referens to self for actionHandler, cancelHandler and destructiveHandler blocks */
Expand All @@ -337,7 +340,7 @@ LGAlertViewWindowLevel;
cancelButtonTitle:(NSString *)cancelButtonTitle
destructiveButtonTitle:(NSString *)destructiveButtonTitle
actionHandler:(void(^)(LGAlertView *alertView, NSString *title, NSUInteger index))actionHandler
cancelHandler:(void(^)(LGAlertView *alertView, BOOL onButton))cancelHandler
cancelHandler:(void(^)(LGAlertView *alertView))cancelHandler
destructiveHandler:(void(^)(LGAlertView *alertView))destructiveHandler;

/** Do not forget about weak referens to self for actionHandler, cancelHandler and destructiveHandler blocks */
Expand All @@ -348,7 +351,7 @@ LGAlertViewWindowLevel;
cancelButtonTitle:(NSString *)cancelButtonTitle
destructiveButtonTitle:(NSString *)destructiveButtonTitle
actionHandler:(void(^)(LGAlertView *alertView, NSString *title, NSUInteger index))actionHandler
cancelHandler:(void(^)(LGAlertView *alertView, BOOL onButton))cancelHandler
cancelHandler:(void(^)(LGAlertView *alertView))cancelHandler
destructiveHandler:(void(^)(LGAlertView *alertView))destructiveHandler;

/** Do not forget about weak referens to self for actionHandler, cancelHandler and destructiveHandler blocks */
Expand All @@ -360,7 +363,7 @@ LGAlertViewWindowLevel;
cancelButtonTitle:(NSString *)cancelButtonTitle
destructiveButtonTitle:(NSString *)destructiveButtonTitle
actionHandler:(void(^)(LGAlertView *alertView, NSString *title, NSUInteger index))actionHandler
cancelHandler:(void(^)(LGAlertView *alertView, BOOL onButton))cancelHandler
cancelHandler:(void(^)(LGAlertView *alertView))cancelHandler
destructiveHandler:(void(^)(LGAlertView *alertView))destructiveHandler;

/** Do not forget about weak referens to self for actionHandler, cancelHandler and destructiveHandler blocks */
Expand All @@ -372,7 +375,7 @@ LGAlertViewWindowLevel;
cancelButtonTitle:(NSString *)cancelButtonTitle
destructiveButtonTitle:(NSString *)destructiveButtonTitle
actionHandler:(void(^)(LGAlertView *alertView, NSString *title, NSUInteger index))actionHandler
cancelHandler:(void(^)(LGAlertView *alertView, BOOL onButton))cancelHandler
cancelHandler:(void(^)(LGAlertView *alertView))cancelHandler
destructiveHandler:(void(^)(LGAlertView *alertView))destructiveHandler;

#pragma mark -
Expand Down Expand Up @@ -477,6 +480,12 @@ LGAlertViewWindowLevel;

- (void)layoutInvalidateWithSize:(CGSize)size;

- (void)forceCancel;
- (void)forceDestructive;
- (void)forceActionAtIndex:(NSUInteger)index;

+ (void)setTintColor:(UIColor *)color;

#pragma mark -

/** Unavailable, use +alertViewWithTitle... instead */
Expand Down
Loading

0 comments on commit 2135bc6

Please sign in to comment.