Here is my code :
- (void)viewDidLoad {
[super viewDidLoad];
int rand2 = arc4random() % 5;
switch (rand2) {
case 0:
imgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"pinkfont.png"]];
break;
case 1:
imgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"greenfont.png"]];
break;
case 2:
imgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"whitefont.png"]];
break;
case 3:
imgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"yellowfont.png"]];
break;
case 4:
imgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"purplefont.png"]];
break;
}
[[[self view] layer] addSublayer:[imgView layer]];
[imgView release];
}
I want to put imgView at the background, but it doesn’t work, I tried to do it with interface Builder with “send to back” but no result. How can I solve this please?
Sorry for my english I’m french 🙂
if you have xib file then drag a image view in your xib file and then from menu tab select layoutand choose sent to back or backward.
or you have to create dynamically then write