iOS: remove my random placed image
I'm using this to display a image randomly on the iPhone screen.
-(IBAction)gunshot {
UIImageView *img = [[UIImageView alloc]
initWithImage:[UIImage imageNamed:@"gunshot.png"]];
img.frame = CGRectMake(0, 0, 85, 63);
img.center = CGPointMake(random() % 350, random() % 350);
[self.view addSubview:img];
[img release];
}
Now my "problem" is to remove the images that pops-up on the screen after lets say 2 sec. Hope you can help me and thanks in ad开发者_C百科vance.
[img performSelector:@selector(removeFromSuperview) withObject:self afterDelay:2.0];
精彩评论