lundi 1 août 2016

Objective c programming in iOS

How to generate multiple random images using a single image and respective image count in Xcode using objective c programatically. I have tried like this - (void)viewDidLoad { [super viewDidLoad]; imgView = [self.view viewWithTag:110]; } -(IBAction)randomize:(id)sender{ for (int i=0;i<13;i++){ UIImageView *localImage = [[UIImageView alloc] init]; int randNumber = arc4random() % 240; [localImage setFrame:CGRectMake(randNumber, 200.0, 50.0, 25.0)]; [localImage setTag:i+100]; [localImage setImage:[UIImage imageNamed:@"11.png"]]; [self.view addSubview:localImage]; NSString *r =[NSString stringWithFormat:@"%d",randNumber]; lab = r; }

Aucun commentaire:

Enregistrer un commentaire