Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/45.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2012/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 带转换的UIImageView_Iphone_Objective C_Uiimageview_Nstimer - Fatal编程技术网

Iphone 带转换的UIImageView

Iphone 带转换的UIImageView,iphone,objective-c,uiimageview,nstimer,Iphone,Objective C,Uiimageview,Nstimer,因此,我有以下代码: timer = [NSTimer scheduledTimerWithTimeInterval:4.0 target:self selector:@selector(a) userInfo:nil repeats:YES]; 此代码中,重复操作a: -(void)a { self.img.image = [UIImage imageNamed:[NSString stringWithFormat:@"wp%@.jpg", i]]; if([i isEqua

因此,我有以下代码:

timer = [NSTimer scheduledTimerWithTimeInterval:4.0 target:self selector:@selector(a) userInfo:nil repeats:YES];
此代码中,重复操作a:

-(void)a {
    self.img.image = [UIImage imageNamed:[NSString stringWithFormat:@"wp%@.jpg", i]];
    if([i isEqualToNumber:[NSNumber numberWithInt:1]]){
    i = [NSNumber numberWithInt:2];
    }else if([i isEqualToNumber:[NSNumber numberWithInt:2]]){
        i = [NSNumber numberWithInt:3];
    }else     if([i isEqualToNumber:[NSNumber numberWithInt:3]]){
        i = [NSNumber numberWithInt:1];
    }
}
这将使用i值更改图像img。我想当改变图像时,会显示一种效果,比如模糊和去模糊img

你知道如何达到这个效果吗

谢谢大家的关注,
阿尔贝托首先,使用NSInteger或int表示i似乎是有意义的。你可以写得更经济一些:

i += i<3 ? 1 : -2;

所以,这个代码[UIView…]和i+=i
[UIView animateWithDuration:1 
                      delay:0 
                    options: UIViewAnimationCurveEaseOut
                 animations:^{
                    self.img.image = [UIImage imageNamed:
                        [NSString stringWithFormat:@"wp%i.jpg", i]];
                             }];