1

I'm using PureLayout library. Github

I've UIScrollView as a fullscreen container.

As a simple example, I've a UIView(0,0,100,50). I want to pin this view's right edge to right edge of UIScrollView.

I'm doing it this way:

UIScrollView *sv = [UIScrollView newAutoLayoutView];
sv.alwaysBounceHorizontal = YES;
[self.view addSubview:sv];
[sv autoPinEdgesToSuperviewEdgesWithInsets:UIEdgeInsetsZero];

UIView *v = [UIView newAutoLayoutView];
v.backgroundColor = [UIColor grayColor];
[v autoSetDimensionsToSize:CGSizeMake(100, 50)];
[sv addSubview:v];
[v autoPinEdgeToSuperviewEdge:ALEdgeTop withInset:15];
[v autoPinEdgeToSuperviewEdge:ALEdgeRight withInset:15];
//[v autoPinEdgeToSuperviewEdge:ALEdgeTrailing withInset:15]; // also tried this

I get result:

enter image description here

I know, I can create a UIView container with same width as UIScrollView, and add it as subview of scrollView and put all custom views into this container, but I wonder why we can't do it with UIScrollView directly.

Almas Adilbek
  • 4,371
  • 10
  • 58
  • 97

1 Answers1

2

In case, someone is bothering with same issue, there is an answer from the owner of PureLayout, he answers my question:
https://github.com/smileyborg/PureLayout/issues/61#issuecomment-93819808

Almas Adilbek
  • 4,371
  • 10
  • 58
  • 97