UIImage *image1 = [UIImage imageNamed:@"weixin.png"];
self.imageView1 = [[UIImageView alloc] initWithImage:image1];
[self.window addSubview:self.imageView1];
//設置一個倒計時間
self.secondsCountDown = 3.0;//3秒倒計時
//創建一個NSTimer計時器
self.countDownTimer = [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(timeFireMethod) userInfo:nil repeats:YES];
-(void)timeFireMethod{
self.secondsCountDown--;
if(self.secondsCountDown == 0){
//如果計時結束countDownTimer被無效
[self.countDownTimer invalidate];
//imageView1透明度設置爲0
self.imageView1.alpha = 0.0;
}
}