-2

您好,感谢您抽出宝贵时间查看我的问题

我有一个逻辑问题,我有一个信息按钮,按下该按钮会更改 UI 图像视图中的图像

  - (IBAction)infopressed:(id)sender {

 useridtext.hidden = YES;
password.hidden = YES;

    //the original image before change is called 'login alpa'

    CATransition *animation = [CATransition animation];
    animation.duration = 2.0;
    animation.type = kCATransitionFade;
    animation.timingFunction = [CAMediaTimingFunction

    functionWithName:kCAMediaTimingFunctionEaseIn];
    [_login.layer addAnimation:animation forKey:@"changeImageTransition"];

    // change image
    _login.image = [UIImage imageNamed:@"imageciren1.jpeg"];


    }

如何将图像视图中的图像更改回登录 alpha?如果他们要按下按钮,请将其更改为 imageciren1 等。

4

2 回答 2

0
- (IBAction)infopressed:(id)sender {
    static int = 0;
    NSString *imageName;
    if (i == 1) {
        imageName = @"loginalpha.jpeg";
        useridtext.hidden = NO;
        password.hidden = NO;
        i--;
    } else {
        imageName = @"imageciren1.jpeg";
        useridtext.hidden = YES;
        password.hidden = YES;
        i++;
    }
    CATransition *animation = [CATransition animation];
    animation.duration = 2.0;
    animation.type = kCATransitionFade;
    animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn];
    [_login.layer addAnimation:animation forKey:@"changeImageTransition"];

    // change image
    _login.image = [UIImage imageNamed:imageName];
}
于 2012-12-02T13:57:32.413 回答
0
- (IBAction)infopressed:(id)sender {
    if (contactlabel.text.length)
        [contactlabel setText:@""];
    else
        [contactlabel setText:@"Test"];
}
于 2012-12-02T14:14:03.693 回答