MMMAutoLayoutScrollView
Objective-C
@interface MMMAutoLayoutScrollView : UIScrollView
Swift
class MMMAutoLayoutScrollView : UIScrollView
A vertical scroll view with a content view and preconfigured constraints, so there is no need in creating a scroll view / content view sandwitch manually every time.
It also supports top and bottom shadows that are displayed only when the content is clipped.
The shadows can be enabled individually and they can sit either flush with the edges of the scroll view
or can be inset according to adjustedContentInset
, which can be handy when vertical safeAreaInsets
need
to be taken into account. (Note that contentInsetAdjustmentBehavior
has to be either None
or Always
on this view since “automatic” options can lead to cyclic calculations.) Also note that scroll indicators
are disabled here by default.
Begin by adding your controls and constraints into the contentView
ensuring that its size can be derived from your
constraints alone. Avoid constraints to the scroll view itself or outside views unless you are prepared to deal
with the consequences.
Note that the width of the contentView
will be constrainted hard to be equal to the width of the scroll view
and its height will be constrained with prio 251 to be at least as large as the height of the scroll view.
-
This is where your content subviews should be added.
Declaration
Objective-C
@property (nonatomic, readonly) MMMAutoLayoutScrollViewContentView *_Nonnull contentView;
Swift
var contentView: MMMAutoLayoutScrollViewContentView { get }
-
Initializes with the given config.
Note
Note that changing the config after the initialization has no effect on the view.Declaration
Objective-C
- (nonnull id)initWithSettings:(nonnull MMMScrollViewShadowsSettings *)settings;
Swift
init(settings: MMMScrollViewShadowsSettings)
-
Initializes with default settings, a shortcut for
initWithSettings:[[MMMScrollViewShadowsSettings alloc] init]
.Declaration
Objective-C
- (nonnull id)init;
Swift
convenience init()
-
Unavailable
Undocumented
Declaration
Objective-C
- (id)initWithCoder:(NSCoder *)aDecoder NS_UNAVAILABLE;
-
Unavailable
Undocumented
Declaration
Objective-C
- (id)initWithFrame:(CGRect)frame NS_UNAVAILABLE;