原代码:
UIEdgeInsets insets = _scrollView.contentInset;
insets.bottom = bounds.size.height;
_scrollView.contentInset = insets;
为什么不能改写成:
_scrollView.contentInset.bottom = bounds.size.height;
原代码:
UIEdgeInsets insets = _scrollView.contentInset;
insets.bottom = bounds.size.height;
_scrollView.contentInset = insets;
为什么不能改写成:
_scrollView.contentInset.bottom = bounds.size.height;
因为 objc 不能返回引用,
_scrollView.contentInset返回UIEdgeInsets是一个结构体,而不是结构体的引用,是一个副本,改了也只是改这一个临时变量。