开发者

iPhone UIButton act like a UISwitch

I'm trying to create a pull out flap for my application. When you tap the image/button th开发者_Python百科e first time, i want it to animate out to reveal the entire image. When you tap it again, i want it to animate back to its original location. I'm a little confused, however, on how to make this happen. I was wondering if there was a way to make this button function as a switch, so that i could program it to simply [do this when state is on] and [do this when state is off]. Help is greatly appreciated!


-(IBAction)buttonClicked:(id)sender
{
 UIButton *button = (UIButton *)sender;
  if(button.tag==0)
 {
   // Do something to animate out to reveal the entire image
   button.tag = 1;
 }
 else if(button.tag==1)
 {
  // Do something else to animate back to its original location
   button.tag = 0;
 }
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜