GithubHelp home page GithubHelp logo

imalertview's Introduction

IMAlertView

IMAlertView is an iOS custom alert view with animation.

Requirements

  • Requires iOS 7 or later
  • Requires Automatic Reference Counting (ARC)

Demo Project

Please feel free to try the IMAlertViewDemo project in Xcode. It demonstrates a simple setup of the alert view.

Installation

CocoaPods

If you are using CocoaPods, simply add pod 'IMAlertView' to your Podfile.

Drag & Drop

Simply drag & drop the IMAlertView folder to your project.

Usage

IMAlertView has a very similar usage to UIAlertView. Please see the following steps:

####1. Import the header file

#import "IMAlertView.h"

####2. Show the alert view

[[[IMAlertView alloc] initWithTitleImage:[UIImage imageNamed:@"someImage"]
                                 message:@"some message"
                                delegate:nil
                       cancelButtonTitle:@"Cancel"
                      confirmButtonTitle:@"OK"] show];

In case you wanted to customize the alert view, I would recommend subclassing it - simply by overriding the init method. Please see the example below:

- (instancetype)initWithTitleImage:(UIImage *)titleImage
                           message:(NSString *)message
                          delegate:(id<IMAlertViewDelegate>)delegate
                 cancelButtonTitle:(NSString *)cancelButtonTitle
                confirmButtonTitle:(NSString *)confirmButtonTitle {
    self = [super initWithTitleImage:titleImage message:message delegate:delegate cancelButtonTitle:cancelButtonTitle confirmButtonTitle:confirmButtonTitle];
    if (self) {
        self.backgroundColor = [UIColor whiteColor];
        
        self.messageLabel.font = [UIFont fontWithName:@"Noteworthy-Light" size:14.0];
        self.messageLabel.textColor = [UIColor blackColor];
        
        self.cancelButton.backgroundColor = [UIColor colorWithWhite:0.9 alpha:0.9];
        self.cancelButton.titleLabel.font = [UIFont fontWithName:@"Noteworthy-Light" size:16.0];
        [self.cancelButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
        
        self.confirmButton.backgroundColor = [UIColor colorWithWhite:0.9 alpha:0.9];
        self.confirmButton.titleLabel.font = [UIFont fontWithName:@"Noteworthy-Bold" size:16.0];
        [self.confirmButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    }
    return self;
}

License

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

imalertview's People

Contributors

imilakovic avatar

Watchers

Carabineiro 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.