Advertisement
Guest User

View

a guest
Nov 11th, 2019
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.92 KB | None | 0 0
  1. View.BackgroundColor = UIColor.LightGray;
  2. Title = "Tip Calculator";
  3. var statusBarHeight = UIApplication.SharedApplication.StatusBarFrame.Height;
  4. var topPadding = UIApplication.SharedApplication.Windows[0].SafeAreaInsets.Top + statusBarHeight;
  5.  
  6. totalAmount = new UITextField()
  7. {
  8. Frame = new CGRect(20, topPadding + 20, View.Bounds.Width - 40, 35),
  9. KeyboardType = UIKeyboardType.DecimalPad,
  10. BorderStyle = UITextBorderStyle.RoundedRect,
  11. Placeholder = "Enter Total Amount",
  12. AutoresizingMask = UIViewAutoresizing.FlexibleWidth
  13. };
  14.  
  15. calcButton = new UIButton(UIButtonType.Custom)
  16. {
  17. Frame = new CGRect(20, 71 + topPadding, View.Bounds.Width - 40, 45),
  18. BackgroundColor = UIColor.FromRGB(0, 0.5f, 0),
  19. AutoresizingMask = UIViewAutoresizing.FlexibleWidth
  20. };
  21. calcButton.SetTitle("Calculate", UIControlState.Normal);
  22.  
  23. resultLabel = new UILabel()
  24. {
  25. Frame = new CGRect(20, 124 + topPadding, View.Bounds.Width - 40, 40),
  26. TextColor = UIColor.Blue,
  27. TextAlignment = UITextAlignment.Center,
  28. Font = UIFont.SystemFontOfSize(24),
  29. Text = "Tip is $0.00",
  30. AutoresizingMask = UIViewAutoresizing.FlexibleWidth
  31. };
  32. navButton = new UIButton(UIButtonType.Custom)
  33. {
  34. Frame = new CGRect(20, 170 + topPadding, View.Bounds.Width - 40, 45),
  35. BackgroundColor = UIColor.FromRGB(0, 0.5f, 0),
  36. AutoresizingMask = UIViewAutoresizing.FlexibleWidth
  37. };
  38. navButton.SetTitle("Navigate", UIControlState.Normal);
  39. View.AddSubviews(totalAmount, calcButton, resultLabel, navButton);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement