Skip to content

Repository files navigation

JCAlertController is same level with UIAlertController.
It is inherited from UIViewController too.
It supports managing presented controllers with FIFO or LIFO.

ComparePresent QueueCustom StyleCustom ViewMinimum iOS Target
JCAlertControllersupportsimplesimpleiOS 7
UIAlertControllernot supportdifficultdifficultiOS 8
  • support present queue
  • support custom style
  • support custom contentView

What is present queue ?

Look at the flowing code:

[selfpresentWithFIFO:alert1];
[selfpresentWithFIFO:alert2];
[selfpresentWithFIFO:alert3];

Result:
alert1 shows first, after dismissed by user, alert2 shows second, after dismissed by user, alert3 shows third.
like this: alert1 >> alert2 >> alert3

[selfpresentWithLIFO:alert1];
[selfpresentWithLIFO:alert2];
[selfpresentWithLIFO:alert3];

Result:
alert3 shows first, after dismissed by user, alert2 shows second, after dismissed by user, alert1 shows third.
like this alert3 >> alert2 >> alert1

Present queue is powered by JCPresentQueue. It supports cocoapods too.

Preview

normal style

normal style(title only)

normal style(content only)

normal style (words oveflow)

custom style

custom contentView

custom contentView and keyboard handle

custom contentView and attributedstring

Struct

.
|____.DS_Store
|____AlertView
| |____JCAlertView.h
| |____JCAlertView.m
|____ButtonItem
| |____JCAlertButtonItem.h
| |____JCAlertButtonItem.m
|____Category
| |____NSAttributedString+JCCalculateSize.h
| |____NSAttributedString+JCCalculateSize.m
| |____UIColor+JCHightlightedColor.h
| |____UIColor+JCHightlightedColor.m
| |____UIImage+JCColor2Image.h
| |____UIImage+JCColor2Image.m
| |____UIViewController+JCPresentQueue.h // present category
| |____UIViewController+JCPresentQueue.m
| |____UIWindow+JCBlur.h
| |____UIWindow+JCBlur.m
|____JCAlertController.h // import this
|____JCAlertController.m
|____Style
| |____JCAlertStyle.h
| |____JCAlertStyle.m
| |____JCAlertStyleAlertView.h
| |____JCAlertStyleAlertView.m
| |____JCAlertStyleBackground.h
| |____JCAlertStyleBackground.m
| |____JCAlertStyleButton.h
| |____JCAlertStyleButton.m
| |____JCAlertStyleButtonCancel.h
| |____JCAlertStyleButtonCancel.m
| |____JCAlertStyleButtonNormal.h
| |____JCAlertStyleButtonNormal.m
| |____JCAlertStyleButtonWarning.h
| |____JCAlertStyleButtonWarning.m
| |____JCAlertStyleContent.h
| |____JCAlertStyleContent.m
| |____JCAlertStyleSeparator.h
| |____JCAlertStyleSeparator.m
| |____JCAlertStyleTitle.h
| |____JCAlertStyleTitle.m

Installation with CocoaPods

step 1

platform :ios, '7.0'
target 'your target'do
pod 'JCAlertController'
end

step 2

#import"JCAlertController.h"

Usage

// LIFO: alert3 >> alert2 >> alert1for (int i = 1; i<4; i++) {
JCAlertController *alert = [JCAlertController alertWithTitle:[NSStringstringWithFormat:@"alert%zi", i] message:nil];
[alert addButtonWithTitle:@"OK"type:JCButtonTypeNormal clicked:nil];
[selfjc_presentViewController:alert presentCompletion:nildismissCompletion:nil];
}

Contact me

E-mail: hjaycee@163.com
Blog: http://www.jianshu.com/u/8bde69945e50

About

AlertController presented FIFO or LIFO and customed easily

Resources

Stars

524 stars

Watchers

12 watching

Forks

Releases

Packages

Used by

Contributors

Languages