Tutorial details

Creating a random word generator | App Code for Sale | Preview

Creating a random word generator | iOS Tutorial

How to create a random word generator

Overview PAGE TOP

Reference: http://www.geekylemon.com/WEBPROTECT-xcoderandomword.htm

In this tutorial i will be show you how to create a random word generator

Features:

  • 1 round rect button
  • 1 UILabel

The random generator works by pressing the round rect button and one of your random outcomes appears in the UILabel useful for creating password generator apps

ViewController.h PAGE TOP

@interface ViewController :UIViewController {
IBOutlet UILabel *textview;
}
-(IBAction)random;
@end

ViewController.m PAGE TOP

@implementation ViewController
-(IBAction)random {
int text = rand() % 5;
switch (text) {
case 0:
textview.text = @"blue";
break;
case 1:
textview.text = @"green";
break;
case 2:
textview.text = @"red";
break;
case 3:
textview.text = @"yellow";
break;
case 4:
textview.text = @"pink";
break;
default:
break;
}
}
@end

Reference PAGE TOP

http://www.geekylemon.com/WEBPROTECT-xcoderandomword.htm

0 Comments Leave a comment

Please login in order to leave a comment.

Newest first
!

Sign-in to your Chupamobile Account.

The Easiest way to Launch your next App or Game.

Join Chupamobile and get instant access to thousands of ready made App and Game Templates.

Creating an account means you’re okay with Chupamobile’s Terms of Service and Privacy Policy.