• Stars
    star
    617
  • Rank 72,724 (Top 2 %)
  • Language
    Objective-C
  • License
    MIT License
  • Created about 12 years ago
  • Updated almost 9 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

WCAlertView is deliverd from UIAlertView. It's support customization and blocks.

WCAlertView

For iOS 8 and above support use my UIAlertController category which works simillar

UIAlertController-MZStyle

iOS 7 and above not supported !

In iOS7, the UIAlertView window does not appear in -[UIApplication windows]. In fact, the UIAlertView itself is never added to any window, -[UIAlertView window] is always nil. Instead, the alert view manages a variety of undocumented views placed in -[UIApplication keyWindow] with no reference back to the alert view.

More informaction on freecoder blog

Stackoverflow issue

Info

WCAlertView is a subclass from UIAlertView with possibility of customization.

You can easly customize your UIAlertView.

How To Use

There are a couple of predefined styles, you might use them instead of writing your own.

WCAlertView supports blocks.

You might set default appearance for all WCAlertView's:

[WCAlertView setDefaultStyle:WCAlertViewStyleWhite];

Set default appearnce block for all WCAlertView's inside AppDelegate (similar to UIAppearance proxy)

[WCAlertView setDefaultCustomiaztonBlock:^(WCAlertView *alertView) {
        alertView.labelTextColor = [UIColor colorWithRed:0.11f green:0.08f blue:0.39f alpha:1.00f];
        alertView.labelShadowColor = [UIColor whiteColor];
        
        UIColor *topGradient = [UIColor colorWithRed:1.0f green:1.0f blue:1.0f alpha:1.0f];
        UIColor *middleGradient = [UIColor colorWithRed:0.93f green:0.94f blue:0.96f alpha:1.0f];
        UIColor *bottomGradient = [UIColor colorWithRed:0.89f green:0.89f blue:0.92f alpha:1.00f];
        alertView.gradientColors = @[topGradient,middleGradient,bottomGradient];
        
        alertView.outerFrameColor = [UIColor colorWithRed:250.0f/255.0f green:250.0f/255.0f blue:250.0f/255.0f alpha:1.0f];
        
        alertView.buttonTextColor = [UIColor colorWithRed:0.11f green:0.08f blue:0.39f alpha:1.00f];
        alertView.buttonShadowColor = [UIColor whiteColor];
}];

If you want to use UITextField for password or plain input text, use UIAlertViewStyle (available since iOS 5.x).

[WCAlertView showAlertWithTitle:@"Some title" message:@"Custom message" customizationBlock:^(WCAlertView *alertView) {
        
        alertView.alertViewStyle = UIAlertViewStyleSecureTextInput;
        
    } completionBlock:^(NSUInteger buttonIndex, WCAlertView *alertView) {

    } cancelButtonTitle:@"Cancel" otherButtonTitles:@"Ok", nil];

How to use:

[WCAlertView showAlertWithTitle:@"Custom AlertView Title" 
					    message:@"You can do a lot of additional setup using WCAlertView." 
					    customizationBlock:^(WCAlertView *alertView) {
					    
        					alertView.style = WCAlertViewStyleVioletHatched;
        					
    } completionBlock:^(NSUInteger buttonIndex, WCAlertView *alertView) {
        
    } cancelButtonTitle:@"Cancel" otherButtonTitles:@"Okay",nil];
WCAlertView *alert = [[WCAlertView alloc] initWithTitle:@"Custom AlertView Title" 
												message:@"You can do a lot of additional setup using WCAlertView." 
											   delegate:nil cancelButtonTitle:@"Cancel" 
											   otherButtonTitles:@"Okay", nil];
											   
    alert.style = WCAlertViewStyleVioletHatched;
    
    [alert show];

Requirements

WCAlertView requires either iOS 4.3 and above.

If you want full functionality, please use iOS 5.x and above.

License

WCAlertView is available under the MIT license. See the LICENSE file for more info.

ARC

WCAlertView uses ARC.

Credits

Inspired by Aaron Crabtree - UIAlertView Custom Graphics , borrowed some general approaches in drawing Alert View. Simple block extension got from wannabegeek.

Contact

Michal Zaborowski

Bitdeli Badge

More Repositories

1

MZFormSheetController

MZFormSheetController provides an alternative to the native iOS UIModalPresentationFormSheet, adding support for iPhone and additional opportunities to setup controller size and feel form sheet.
Objective-C
2,534
star
2

MZFormSheetPresentationController

MZFormSheetPresentationController provides an alternative to the native iOS UIModalPresentationFormSheet, adding support for iPhone and additional opportunities to setup UIPresentationController size and feel form sheet.
Objective-C
974
star
3

INSPullToRefresh

A simple to use very generic pull-to-refresh and infinite scrolling functionalities as a UIScrollView category.
Objective-C
814
star
4

MZDayPicker

An iOS day picker to allow users to select date
Objective-C
620
star
5

INSElectronicProgramGuideLayout

UICollectionViewLayout for displaying electronic program guide.
Objective-C
487
star
6

INSPhotoGallery

INSPhotoGallery is a modern looking photo gallery written in Swift for iOS.
Swift
396
star
7

MZBookshelfCollectionViewLayout

Bookshelf like iBooks layout for UICollectionView.
Objective-C
122
star
8

INSOperationsKit

Objective-C adaptation of the sample code provided in the Advanced NSOperations session of WWDC 2015
Objective-C
112
star
9

MZAppearance

UIAppearance proxy for custom objects
Objective-C
106
star
10

MZSelectableLabel

A simple to use drop in replacement for UILabel for iOS 7 that provides automatic detection of colors.
Objective-C
102
star
11

UIAlertController-MZStyle

Category for UIAlertController customization
Objective-C
94
star
12

MZFayeClient

Faye Client for iOS. Supports subscription blocks.
Objective-C
84
star
13

INSPersistentContainer

Open Source, 100% API compatible replacement of NSPersistentContainer for iOS8+
Objective-C
65
star
14

SpotifyImporter

Spotify library importer into Apple Music
Objective-C
55
star
15

WCBeforeAfter

Objective-C BeforeAfter
Objective-C
52
star
16

INSNibLoading

A UIView/NSView category and a subclass for loading custom view from UINib (xib) files
Objective-C
26
star
17

AccessibilityIdentificable

Identifiers for UI testing: a reflection based approach
Swift
22
star
18

source-tree-custom-commands

A collection of SourceTree CustomActions.
Shell
20
star
19

RWMAmazonProductAdvertisingManager

AFNetworking Client for Amazon Product Advertising API
Objective-C
13
star
20

ContextWatcher

Example which shows how to observe changes on single NSManagedObject instance
Swift
13
star
21

RWMVimeoClient

AFNetworking Client for Vimeo Advanced API
Objective-C
12
star
22

CCTouchableSprite

Touchable CCSprite for cocos2d framework with Objective-C Blocks
Objective-C
7
star
23

xcode-themes

My Xcode themes
1
star