Advertisement
Guest User

Untitled

a guest
Mar 2nd, 2022
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @implementation WelcomeViewController
  2.  
  3. - (UIButton *)signInButton {
  4.   UIButton *button = [[UIButton alloc] init];
  5.   button.backgroundColor = [UIColor systemRedColor];
  6.   button.layer.borderWidth = 2;
  7.   button.clipsToBounds = YES;
  8.  
  9.   [button setTitle:@"Apple IDでログイン" forState:UIControlStateNormal];
  10.   [button setTitleColor:[UIColor systemBackgroundColor] forState:UIControlStateNormal];
  11.  
  12.   return button;
  13. }
  14.  
  15. - (void)viewDidLoad {
  16.   [super viewDidLoad];
  17.   // Do any additional setup after loading the view.
  18.  
  19.   self.title = @"タイトル";
  20.   self.view.backgroundColor = [UIColor systemGreenColor];
  21.  
  22. //  UIButton *button = [[UIButton alloc] init];
  23. //  button.backgroundColor = [UIColor clearColor];
  24. //  button.layer.borderWidth = 2;
  25. //  button.clipsToBounds = YES;
  26. //
  27. //  [button setTitle:@"Apple IDでログイン" forState:UIControlStateNormal];
  28. //  [button setTitleColor:[UIColor systemBackgroundColor] forState:UIControlStateNormal];
  29. //
  30. //  self.signInButton = button;
  31.  
  32.   [self.view addSubview:self.signInButton];
  33. }
  34.  
  35. - (void)viewDidLayoutSubviews {
  36.   [super viewDidLayoutSubviews];
  37.  
  38.   self.signInButton.frame = CGRectMake(20, self.view.frame.size.height - 50 - self.view.safeAreaInsets.bottom, self.view.frame.size.width * 0.9, 50);
  39.   self.signInButton.layer.cornerRadius = self.signInButton.frame.size.height / 2;
  40.  
  41.   [self.signInButton addTarget:self action:@selector(handlePress:) forControlEvents:UIControlEventTouchUpInside];
  42. }
  43.  
  44. - (void)handlePress: (UIButton *) sender {
  45.   printf("Button pressed!");
  46. }
  47.  
  48. @end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement