Quantcast
Channel: leapingbytes.com - ios
Viewing all articles
Browse latest Browse all 12

Why is it still not part of iOS?

$
0
0

 I guess with all changes happening in other parts of the iOS, UIAlertView is not at the top of the Apple dev's TO-DO list.  Even though Objective-C world has been enjoying blocks for couple years now, there are still no block-ified UIAlertView API :(. Luckily it is quite simple to rectify this minor omission.  Take a look at this gist. Just few lines of Objective-C and you can do this:

LBAlertView *alert = [[LBAlertViewalloc] initWithTitle:@"Title"message: nildelegate:selfcancelButtonTitle:@"Cancel"otherButtonTitles: @"Enter", nil];

alert.onClickBlock = ^(UIAlertView* alertView, int buttonIndex) {

    if (buttonIndex == 1) {

        // do something

    }

    else {

        // do something else

    }

};

[alert show];

Share and enjoy !

tags: 

Viewing all articles
Browse latest Browse all 12

Latest Images

Trending Articles





Latest Images