Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Seems that you are missing some basic stuff about UIScrollView in autolayout environment. Read carefully <a href="http://developer.apple.com/library/ios/#releasenotes/General/RN-iOSSDK-6_0/index.html" rel="noreferrer">ios 6.0 release notes</a> </p> <p>Your code should look like:</p> <pre><code>- (void)viewDidLoad { [super viewDidLoad]; CGRect selfBounds = self.view.bounds; CGFloat width = CGRectGetWidth(self.view.bounds); CGFloat height = CGRectGetHeight(self.view.bounds); [_scrollview setPagingEnabled:YES]; UIView* view1 = [[UIView alloc] initWithFrame:selfBounds]; [view1 setTranslatesAutoresizingMaskIntoConstraints:NO]; [view1 setBackgroundColor:[UIColor redColor]]; [_scrollview addSubview:view1]; UIView* view2 = [[UIView alloc]initWithFrame:CGRectOffset(selfBounds, width, 0)]; [view2 setTranslatesAutoresizingMaskIntoConstraints:NO]; view2.backgroundColor = [UIColor greenColor]; [_scrollview addSubview:view2]; [_scrollview addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"|[view1(width)][view2(width)]|" options:0 metrics:@{@"width":@(width)} views:NSDictionaryOfVariableBindings(view1,view2)]]; [_scrollview addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[view1(height)]|" options:0 metrics:@{@"height":@(height)} views:NSDictionaryOfVariableBindings(view1)]]; [_scrollview addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[view2(height)]|" options:0 metrics:@{@"height":@(height)} views:NSDictionaryOfVariableBindings(view2)]]; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload