ios 怎样将uiimage 对象 放入 数组中

2024-11-26 05:44:35
推荐回答(1个)
回答1:

NSArray *array = [NSArrayarrayWithObjects:[UIImageimageNamed:@"bird6"],
[UIImageimageNamed:@"bird7"], nil];

srandom(time(NULL));
int a = random()%2;
UIImage *image = [array objectAtIndex:a];
UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
[view addSubview:imageView];
[imageView release];