jivadevoe / uialertview-blocks Goto Github PK
View Code? Open in Web Editor NEWA category for UIAlertView which allows you to use blocks to handle the pressed button events rather than implementing a delegate.
License: MIT No Attribution
A category for UIAlertView which allows you to use blocks to handle the pressed button events rather than implementing a delegate.
License: MIT No Attribution
Issue is described on SF - http://stackoverflow.com/questions/5262428/uiactionsheet-buttonindex-values-faulty-when-using-more-than-6-custom-buttons
Need to implement this option - http://screencast.com/t/aE7pcnPPQU6
After installing it with cocoapods, I can't find a swift alternate method for this initialize method.
-(id)initWithTitle:(NSString *)inTitle message:(NSString *)inMessage cancelButtonItem:(RIButtonItem *)inCancelButtonItem otherButtonItems:(RIButtonItem *)inOtherButtonItems, ... NS_REQUIRES_NIL_TERMINATION;
iOS8 and orientation upside-down causes an actionsheet upside-down.
Love to have the new UIAlertController iOS8 integration and have iOS7 backward-support without modifying my code :-)
Could you add this to Cocoapods?
Thanks,
Ryan
It works normally when I use the default init method " [[UIActionSheet alloc] initWithTitle:cancelButtonItem:destructiveButtonItem:otherButtonItems]".
But when i use the addButtonItem method to dynamically add ActionSheet button items, the block will not trigger when i tap the button
Hi, thanks for the great extension.
When I try to install new pods with 'pod install' I get this:
[!] Unable to read the license file `[project_dir]/Pods/UIAlertView-Blocks/LICENSE` for the spec `UIAlertView-Blocks (1.0)`
Nothing critical but can it be fixed?
Thanks a lot.
diff --git a/UIActionSheet+Blocks.m b/UIActionSheet+Blocks.m
index f155547..6b8c8e5 100644
--- a/UIActionSheet+Blocks.m
+++ b/UIActionSheet+Blocks.m
@@ -69,6 +69,7 @@ static NSString *RI_BUTTON_ASS_KEY = @"com.random-ideas.BUTTONS";
Hi,
It seems that dismissing an alertView using:
[alertview dismissWithClickedButtonIndex:0 animated:YES];
dismisses the alertView, but does not call the button's action.
Long UIActionSheet-Blocks that need to scroll cause the wrong block to be called. It looks like an "off by one" error. I have a very simple project that displays the behavior.
https://github.com/rmartens/UIActionSheetBlocksTest
I am using uialertview with blocks in serveral apps; having a slightly different, less verbose approach - you also might find interesting.
https://github.com/steipete/PSFoundation/blob/master/Utils/PSAlertView.h
Example Code:
PSAlertView *alert = [PSAlertView alertWithTitle:alertTitle message:alertMessage];
[alert setCancelButtonWithTitle:LocalizedString(@"Okay") block:^{}];
[alert addButtonWithTitle:LocalizedString(@"Retry") block: ^{
NSError *error = nil;
[self sendMessage:message error:&error];
}];
[alert show];
I have a tricky situation when using UIAlertViewStylePlainTextInput
style:
RIButtonItem *cancelItem = [RIButtonItem itemWithLabel:NSLocalizedString(@"Cancel", nil) action:^{
[tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationAutomatic];
}];
RIButtonItem *okItem = [RIButtonItem itemWithLabel:NSLocalizedString(@"OK", nil) action:^{
// how can I access the UIAlertView?
}];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:file.displayName
message:nil
cancelButtonItem:cancelItem
otherButtonItems:okItem, nil];
alert.alertViewStyle = UIAlertViewStylePlainTextInput;
UITextField *textField = [alert textFieldAtIndex:0];
textField.keyboardType = UIKeyboardTypeDefault;
textField.text = file.displayName;
[alert show];
okItem
has to be defined before alert
alert
has to be defined before textField
How can I access textField.text
in okItem
block?
UIAlertViewDelegate
contains method alertViewShouldEnableFirstOtherButton:`` but your code doesn't allow to use it because it sets delegate to
self``` (this category) and so it is impossible just to write this method outside this category when it is necessary
A lot of "UIAlertView+Blocks.m:43:41: '__bridge' casts have no effect when not using ARC" warnings when using in non ARC project
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.