Browse Source

Add bug switcher

xcbosa mbp16 2 years ago
parent
commit
d6aac8ea9f
1 changed files with 7 additions and 2 deletions
  1. 7 2
      ScrollViewBug/ViewController.m

+ 7 - 2
ScrollViewBug/ViewController.m

@@ -72,14 +72,19 @@ static char * const kTableCellKVOKey = "kTableCellKVOKey";
 @implementation ViewController
 
 - (void)viewDidLoad {
+    BOOL bug = YES;
     [super viewDidLoad];
     
-    self.navigationItem.titleView = [UISwitch new];
+    self.navigationItem.title = bug ? @"Bug" : @"No Bug";
     [self.view addSubview:self.scrollView];
     [self.scrollView addSubview:self.stackView];
     
     [self.scrollView.leftAnchor constraintEqualToAnchor:self.view.leftAnchor].active = true;
-    [self.scrollView.topAnchor constraintEqualToAnchor:self.view.safeAreaLayoutGuide.topAnchor].active = true;
+    if (bug) {
+        [self.scrollView.topAnchor constraintEqualToAnchor:self.view.topAnchor].active = true;
+    } else {
+        [self.scrollView.topAnchor constraintEqualToAnchor:self.view.safeAreaLayoutGuide.topAnchor].active = true;
+    }
     [self.scrollView.rightAnchor constraintEqualToAnchor:self.view.rightAnchor].active = true;
     [self.scrollView.bottomAnchor constraintEqualToAnchor:self.view.bottomAnchor].active = true;