GithubHelp home page GithubHelp logo

raybon-lee / monpromptview Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mownier/monpromptview

0.0 2.0 0.0 1.02 MB

A custom simple prompt view.

License: MIT License

Ruby 1.65% Objective-C 98.35%

monpromptview's Introduction

MONPromptView

A custom simple prompt view. It consists only title and message labels, and a single dismiss button where the text color and font of the two labels and the button can be customized.

![MONPromptView] (https://raw.github.com/mownier/MONPromptView/master/screenshot.gif)

Initialization

- (void)viewDidLoad {
    [super viewDidLoad];
    NSString *title = @"Hello, John Doe!";
    NSString *message = @"Welcome, Home.";
    NSString *dismissTitle = @"OK";
    MONPromptView *promptView = [[MONPromptView alloc] initWithTitle:title 
                                                             message:message 
                                                  dismissButtonTitle:dismissTitle];
}

Customization

- (void)viewDidLoad {
    [super viewDidLoad];
    NSString *title = @"Hello, John Doe!";
    NSString *message = @"Welcome, Home.";
    NSString *dismissTitle = @"OK";
    NSDictionary *attributes = @{ kMONPromptViewAttribDismissButtonBackgroundColor: [UIColor colorWithRed:40/255.0f green:122/255.0f blue:1.0f alpha:1.0f],
                                  kMONPromptViewAttribDismissButtonTextColor: [UIColor whiteColor],
                                  kMONPromptViewAttribDismissButtonFont: [UIFont fontWithName:@"HelveticaNeue-Light" size:14.0f],
                                  kMONPromptViewAttribMessageFont: [UIFont fontWithName:@"HelveticaNeue-Light" size:16.0f],
                                  kMONPromptViewAttribTitleFont: [UIFont fontWithName:@"HelveticaNeue-Medium" size:18.0f] };
    MONPromptView *promptView = [[MONPromptView alloc] initWithTitle:title
                                                             message:message
                                                  dismissButtonTitle:dismissTitle 
                                                          attributes:attributes];
}

Attribute Keys

// Dismiss Button Background Color
kMONPromptViewAttribDismissButtonBackgroundColor

// Dismiss Button Text Color
kMONPromptViewAttribDismissButtonTextColor

// Dismiss Button Font
kMONPromptViewAttribDismissButtonFont

// Title Text Color
kMONPromptViewAttribTitleTextColor

// Title Font
kMONPromptViewAttribTitleFont

// Messsage Text Color
kMONPromptViewAttribMessageTextColor

// Message Font
kMONPromptViewAttribMessageFont

Delegate

@interface ViewController : UIViewController<MONPromptViewDelegate>

@end

@implementation ViewController

#pragma mark -
#pragma mark - MONPromptView Delegate

- (void)promptViewWillDismiss:(MONPromptView *)promptView {
    // TODO Handle on dismiss
}

@end

Displaying Prompt View

// If there is no navigation controller
[promptView showInView:self.view];

// If there is a navigation controller
[promptView showInView:self.navigationController.view];

monpromptview's People

Contributors

mownier avatar

Watchers

James Cloos avatar raybon.lee 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.