iPhone: UIImageView Fades in - Howto?

前端 未结 7 1089
礼貌的吻别
礼貌的吻别 2021-02-02 13:22

I have an UIImageView that I want to fade in.

Is there a way to enable that on an underlying UIViewController?

I have translated the s

相关标签:
7条回答
  • 2021-02-02 13:51

    You can use this code:

    Fade In Animation:

    self.yourComponent.alpha = 0.0f;
    [UIView beginAnimations:@"fadeIn" context:nil];
    [UIView setAnimationDuration:1.0]; // Time in seconds
    self.yourComponent.alpha = 1.0f;
    

    Fade Out Animation:

    self.yourComponent.alpha = 1.0f;
    [UIView beginAnimations:@"fadeOut" context:nil];
    [UIView setAnimationDuration:1.0]; // Time in seconds
    self.yourComponent.alpha = 0.0f;
    

    self.yourComponent can be a UIView, UIImageView, UIButton or any other component.

    0 讨论(0)
提交回复
热议问题