Skip to content
This repository has been archived by the owner on Apr 10, 2023. It is now read-only.

UIAlertView & UIActionSheet subclasses using Blocks rather than delegate callbacks

Notifications You must be signed in to change notification settings

maxkramer/BlockUIAlertViewActionSheet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MKBlocks - UIAlertView and UIActionSheet

Block implementations for UIAlertView and UIActionSheet

The subclasses are incredibly easy to implement, and require you to conform to the block:

typedef void(^MKActionBlock)(NSInteger buttonIndex);

Which can be done as used in the demo (MKBlockActionSheet), shown below.

The NSInteger buttonIndex variable returns the index of the tapped button in either the UIAlertView or UIActionSheet.

[actionSheet setActionBlock:^(NSInteger buttonIndex) {
   
    if (buttonIndex == actionSheet.cancelButtonIndex) {
        
        [[labels objectAtIndex:1] setText:@"You are ... neither ... male nor female!"];
        
    }
    
    else if (buttonIndex == 1) {
        
        [[labels objectAtIndex:1] setText:@"You are Male!"];
        
    }
    
    else if (buttonIndex == 2) {
        
        [[labels objectAtIndex:1] setText:@"You are Female!"];
        
    }
    
}];

If you have any issues with this project, feel free to open an issue or pull request if you have a fix for the issue.

Apart from that, feel free to follow me on Twitter: http://twitter.com/_max_k !

image image

About

UIAlertView & UIActionSheet subclasses using Blocks rather than delegate callbacks

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published