Programmatically created a scroll view then added a label.
scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0,0,self.view.frame.size.width, self.view.frame.size.height)];
[self.view addSubview:scrollView];
then label
UILabel *errLabel = [[UILabel alloc] init];
errLabel.text = @"Top Label";
//errLabel.frame = CGRectMake(self.view.frame.size.width/2,50,120,20);
errLabel.frame = CGRectMake(CGRectGetWidth(scrollView.frame)/2.00,50,120,20);
errLabel.textAlignment = NSTextAlignmentCenter;
errLabel.layer.borderColor = [UIColor grayColor].CGColor;
errLabel.layer.borderWidth = 3.0;
[errLabel setFont:[UIFont fontWithName:@"Helvetica-Bold" size:14]];
[scrollView addSubview:errLabel];
In the simulator for iPhone 8, 11 Pro Max, and biggest iPad the label is right of center. Is this an iOS 11 bug or am I missing something?