Im just fiddling around with small apps, trying to learn the SDK and ObjC 2.
Im trying to display an image randomly and I keep finding different ways up displaying a picture. I have uploaded the picture into the SDKs resources folder.
Anyway, here is my code. Can someone steer me in the right direction.
#import "randomViewController.h"
@implementation randomViewController
//not sure if this is the right way to do it really.
NSArray *comImage = [NSArray arrayWithObjects:
[UIImage imageNamed:@"rock.png"],
[UIImage imageNamed:@"paper.png"],
[UIImage imageNamed:@"scissors.png"],
nil];
- (IBAction) randButton {
int text = rand() % 3;
switch (text) {
case 0:
textView.text = @"Rock";
break;
case 1:
textView.text = @"Paper";
break;
case 2:
textView.text = @"Scissors";
break;
default:
break;
}
}