Coder Social home page Coder Social logo

brickleberry / jcalertcontroller Goto Github PK

View Code? Open in Web Editor NEW

This project forked from richdaddycashmany/jcalertcontroller

0.0 2.0 0.0 958 KB

AlertController presented FIFO or LIFO and customed easily

License: MIT License

Ruby 0.63% Objective-C 99.37%

jcalertcontroller's Introduction

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

Compare Present Queue Custom Style Custom View Minimum iOS Target
JCAlertController support simple simple iOS 7
UIAlertController not support difficult difficult iOS 8
  • support present queue
  • support custom style
  • support custom contentView

What is present queue ?

Look at the flowing code:

[self presentWithFIFO:alert1];
[self presentWithFIFO:alert2];
[self presentWithFIFO:alert3];

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

[self presentWithLIFO:alert1];
[self presentWithLIFO:alert2];
[self presentWithLIFO: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 >> alert1
for (int i = 1; i<4; i++) {
JCAlertController *alert = [JCAlertController alertWithTitle:[NSString stringWithFormat:@"alert%zi", i] message:nil];
[alert addButtonWithTitle:@"OK" type:JCButtonTypeNormal clicked:nil];
[self jc_presentViewController:alert presentCompletion:nil dismissCompletion:nil];
}

Contact me

E-mail: [email protected]
Blog: http://www.jianshu.com/u/8bde69945e50

jcalertcontroller's People

Contributors

richdaddycashmany avatar onelongx avatar readmecritic avatar

Watchers

James Cloos avatar brickleberry avatar

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.