开发者

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];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜