Rendom Select Background
View.m
NSArray *main_background=[[NSMutableArray alloc]initWithObjects:@"mainscreen2.png.jpg",@"background_2.jpg",@"background_3.jpg",@"background_4.jpg",@"background_5.jpg",@"background_6.jpg",@"background_7.jpg",@"background_6.jpg",@"background_5.jpg",@"background_3.jpg", nil];
bgindx=arc4random() % [main_background count];
//NSArray *main_img=[[NSArray alloc]initWithObjects:@"mainscreen2.png.jpg", nil];
UIGraphicsBeginImageContext(self.view.frame.size);
[[UIImage imageNamed:[main_background objectAtIndex: bgindx]] drawInRect:self.view.bounds];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
Comments
Post a Comment