Tutorial details

Random Text Colour Generator | App Code for Sale | Preview

Random Text Colour Generator | iOS Tutorial

How to create a random text colour generator

Overview PAGE TOP

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

In this tutorial i will be showing you how to create a random text colour generator

Features:

  • 1 Label
  • 1 Round Rect button

Creating random text colours will change the look and feel of an app dramatically and at random the user will not know whats coming next, Also used in games where a user would have to state the text colour to earn points

ViewController.h PAGE TOP

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

ViewController. PAGE TOP

@implementation ViewController
-(IBAction)RandomColour {
int textcolour = rand() %5;
switch (textcolour) {
case 0:
label.textColor = [UIColor redColor];
break;
case 1:
label.textColor = [UIColor blueColor];
break;
case 2:
label.textColor = [UIColor greenColor];
break;
case 3:
label.textColor = [UIColor orangeColor];
break;
case 4:
label.textColor = [UIColor yellowColor];
break;  
default:
break;
    }   
}
@end

Reference PAGE TOP

http://www.geekylemon.com/WEBPROTECT-xcoderandomtextcolour.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.