public override void ViewDidLoad() { base.ViewDidLoad(); Random rnd = new Random((int)DateTime.UtcNow.Ticks); // background using (var image = UIImage.FromBundle("back.png")) { UIImageView imageView = new UIImageView(image); imageView.Frame = View.Frame; imageView.AutoresizingMask = UIViewAutoresizing.FlexibleDimensions; View.AddSubview(imageView); } // the flip numbers FlipNumbersView flipView = new FlipNumbersView(digitsCount: 4); // flipView.FlipDuration = 1.0; flipView.Value = rnd.Next(9999); View.AddSubview(flipView); flipView.Center = View.Center; // the button UIButton randomize = new UIButton(UIButtonType.RoundedRect); randomize.Frame = new CGRect(12, View.Frame.Height - 12 - 50 - 12, View.Frame.Width - 12 - 12, 50); randomize.BackgroundColor = UIColor.DarkGray; randomize.AutoresizingMask = UIViewAutoresizing.FlexibleMargins; randomize.SetTitle("Flip To New Number", UIControlState.Normal); randomize.TouchUpInside += delegate { flipView.SetValue(rnd.Next(9999), animated: true); }; View.AddSubview(randomize); }
public override void ViewDidLoad () { base.ViewDidLoad (); Random rnd = new Random ((int)DateTime.UtcNow.Ticks); // background using (var image = UIImage.FromBundle ("back.png")) { UIImageView imageView = new UIImageView (image); imageView.Frame = View.Frame; imageView.AutoresizingMask = UIViewAutoresizing.FlexibleDimensions; View.AddSubview (imageView); } // the flip numbers FlipNumbersView flipView = new FlipNumbersView (digitsCount: 4); // flipView.FlipDuration = 1.0; flipView.Value = rnd.Next (9999); View.AddSubview (flipView); flipView.Center = View.Center; // the button UIButton randomize = new UIButton (UIButtonType.RoundedRect); randomize.Frame = new CGRect (12, View.Frame.Height - 12 - 50 - 12, View.Frame.Width - 12 - 12, 50); randomize.BackgroundColor = UIColor.DarkGray; randomize.AutoresizingMask = UIViewAutoresizing.FlexibleMargins; randomize.SetTitle ("Flip To New Number", UIControlState.Normal); randomize.TouchUpInside += delegate { flipView.SetValue (rnd.Next (9999), animated: true); }; View.AddSubview (randomize); }