Is there toggle button for xamarin.ios? If not, the better aproach is work with two buttons and toggle their Hidden property?
Thank you
To solve your problem:
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
// Perform any additional setup after loading the view, typically from a nib.
UIButton btnPlayAndStop = new UIButton (new CGRect (100, 100, 50, 50));
btnPlayAndStop.BackgroundColor = UIColor.Gray;
btnPlayAndStop.Tag = 0;
btnPlayAndStop.SetImage (UIImage.FromFile ("play.png"), UIControlState.Normal);
btnPlayAndStop.TouchUpInside += delegate {
if (0 == btnPlayAndStop.Tag) {
btnPlayAndStop.Tag = 1;
btnPlayAndStop.SetImage (UIImage.FromFile ("stop.png"), UIControlState.Normal);
}
else if (1 == btnPlayAndStop.Tag) {
btnPlayAndStop.Tag = 0;
btnPlayAndStop.SetImage (UIImage.FromFile ("play.png"), UIControlState.Normal);
}
};
this.View.AddSubview (btnPlayAndStop);
}
Hope it can help you.
Any problem about Xamarin.iOS is welcome.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.