0

IBで作成したボタンがあります

しばらくすると、このボタンを画面に出力します

それをクリックすると、非表示になります

[UIView animateWithDuration:0.2f
                      delay:0
                    options:UIViewAnimationOptionCurveEaseInOut
                 animations:^
 {

     self.checkYESButton.alpha = 0.0f;


 }
                 completion:^(BOOL finished)
 {

     self.checkYESButton.hidden = YES;

 }];

}

もう一度撮ってイメージを変えたいのですが、何も起こりません

self.checkYESButton.hidden = NO;

[_checkYESButton setImage:[UIImage imageNamed:@"checkYESLeft.png"] forState:UIControlStateNormal];

self.checkYESButton.alpha = 1;
self.checkYESButton.frame =  CGRectMake( -100, 185, 106, 90);

    [UIView animateWithDuration:0.15f
                           delay:1
                         options:UIViewAnimationOptionCurveEaseInOut
                      animations:^
      {
          self.checkYESButton.center =  CGPointMake(176, 185);   
      }
                      completion:^(BOOL finished)
      {
      }

同じように、以前は使用しなかった別のボタンを持ってくると、ボタンは正常に表示されます

アップデート

    self.checkYESButton.hidden = NO;

    [_checkYESButton setImage:[UIImage imageNamed:@"checkYESLeft.png"] forState:UIControlStateNormal];

    self.checkYESButton.alpha = 1;
    self.checkYESButton.frame =  CGRectMake( -100, 185, 106, 90);

        [UIView animateWithDuration:0.15f
                               delay:1
                             options:UIViewAnimationOptionCurveEaseInOut
                          animations:^
          {
              self.checkYESButton.center =  CGPointMake(176, 185);

              // code is below decide this situation (only in this line)
              self.checkYESButton = [UIButton buttonWithType:UIButtonTypeCustom]; 
          }
                          completion:^(BOOL finished)
          {
          }
4

0 に答える 0