1

I have a little problem on my Xcode project (iPhone app). I just modified the rounded rect UIButton I used before to a custom one but now the hidden property isn't working anymore.

if (artwork)
    {
    artworkImage = [artwork imageWithSize: CGSizeMake (256, 256)];
    shareButton.alpha = 1.0;
    shareButton.enabled = YES;
    //[shareButton setHidden:NO];   // Won't work, I don't know why
    }
else
    {
    shareButton.alpha = 0.0;
    shareButton.enabled = NO;
    //[shareButton setHidden:YES];   // Won't work, I don't know why
    }

I found a workaround, using enabled property and alpha instead of hidden. But I would like to understand why the hidden property isn't working anymore.

Thanks for the answers.

THelper
  • 15,333
  • 6
  • 64
  • 104

2 Answers2

0

Are you trying to animate the show/hide? I believe the hidden property is not animatable. See this question. A workaround in this case is to use the alpha property use the animation callback ([UIView setAnimationDidStopSelector:]) to set the visible state after the animation has been completed.

Community
  • 1
  • 1
Krumelur
  • 31,081
  • 7
  • 77
  • 119
0

Try shareButton.hidden=YES;

Illep
  • 16,375
  • 46
  • 171
  • 302