Giter Site home page Giter Site logo

jivadevoe / uialertview-blocks Goto Github PK

View Code? Open in Web Editor NEW
881.0 881.0 180.0 389 KB

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

Objective-C 91.89% Ruby 8.11%

uialertview-blocks's People

Contributors

aporat avatar bjornartollaksen avatar dillan avatar gfontenot avatar jivadevoe avatar martica avatar ordovician avatar p-l avatar pburleson avatar slevin avatar vortec4800 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

uialertview-blocks's Issues

how to use it with swift?

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;

pod install: Unable to read the license file

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.

no iOS8 support for upside-down orientations

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 :-)

Another approach (not an issue)

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];

ARC Parse Issue

A lot of "UIAlertView+Blocks.m:43:41: '__bridge' casts have no effect when not using ARC" warnings when using in non ARC project

Pragmas to quite the compiler, patch

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";

  • (void)actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex
    {
    +#pragma unused(actionSheet)
    if (buttonIndex != -1)
    {
    NSArray *buttonsArray = objc_getAssociatedObject(self, RI_BUTTON_ASS_KEY);
    diff --git a/UIAlertView+Blocks.m b/UIAlertView+Blocks.m
    index 2764467..93522fa 100644
    --- a/UIAlertView+Blocks.m
    +++ b/UIAlertView+Blocks.m
    @@ -60,6 +60,7 @@ static NSString *RI_BUTTON_ASS_KEY = @"com.random-ideas.BUTTONS";
  • (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex
    {
    +#pragma unused(alertView)
    NSArray *buttonsArray = objc_getAssociatedObject(self, RI_BUTTON_ASS_KEY);
    RIButtonItem *item = [buttonsArray objectAtIndex:buttonIndex];
    if(item.action)

Cocoapods

Could you add this to Cocoapods?

Thanks,
Ryan

How to access the UIAlertView in RIButtonItem action block?

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.