Giter Site home page Giter Site logo

inyourface's Introduction

InYourFace

An iOS app demonstrating alert views with movie lines

###Step 1: Set a rootViewController in a UINavigationController (you don't need an XIB)

  • You should be able to do this in your sleep now.

###Step 2: Create the Alert and Responses to User Interaction

  • Create a method named presentAlertViewController
  • Instantiate a UIAlertController with a title, message, and UIAlertControllerStyleAlert style
  • In the viewDidLoad method instatiate an alert
  • Add two actions:
    • "Never Again" - log "I'll never show the alert again" as a response
    • "Hit Me" - present the AlertViewController again
  • Call the presentAlertViewController method in the viewDidLoad

###Step 3: Add alert delegate methods

  • Add a data method that returns an array of movie lines
  • Add a method that returns a random title
  • Set the title of the UIAlertController to use the random movie line
- (NSString *)randomTitle {

    int index = arc4random_uniform([self lines].count);
    return [self lines][index];
    
}

- (NSArray *)lines {

    return @[@"If peeing is cool, consider me Miles Davis",
             @"We don't need no stinking badges",
             @"Thank you very little",
             @"You can't fight in here. This is a war room.",
             @"There's no crying in baseball",
             @"I have nipples, greg. Could you milk me?",
             @"You could be drinking whole, if you wanted to.",
             @"Fat guy in a little coat",
             @"How can we be expected to teach children how to read if they can't even fit inside the building?"];
    
}

inyourface's People

Contributors

jkhowland avatar calebhicks avatar

Watchers

James Cloos avatar David Monson 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.