xib do scrollView iOS

demo site: https://gitee.com/songshuangjun/scrollView

Just simple, a scrollIView, an innerView inside. The specific operation screenshots are as follows.

1. Constrain the scrollIView up, down, left and right

2. The width and height of innerIView.

3。

.

4.

 

 

5. Combine the code.

demo site: https://gitee.com/songshuangjun/scrollView

@property (weak, nonatomic) IBOutlet NSLayoutConstraint *InnerW;

@property (weak, nonatomic) IBOutlet NSLayoutConstraint *innerH;

@end



@implementation ViewController

- (void)updateViewConstraints

{

    [super updateViewConstraints];

    /*
     * 这里设置ScrollView的ContentSize;

     * 这里设置了5横屏, 俩竖屏滚动。
     */

    _InnerW.constant = [UIScreen mainScreen].bounds.size.width * 5;

    _innerH.constant = [UIScreen mainScreen].bounds.size.height * 2;

}

 

Guess you like

Origin blog.csdn.net/ximiaoweilai/article/details/105076604