From 6bf37ae70b0979ac0bff6260f79e585e8c183ffa Mon Sep 17 00:00:00 2001 From: YJ Date: Tue, 9 Jan 2018 11:40:14 +0800 Subject: [PATCH] #376, CustomView have Button can't response Action --- Source/UIScrollView+EmptyDataSet.m | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Source/UIScrollView+EmptyDataSet.m b/Source/UIScrollView+EmptyDataSet.m index 27d0a3a7..671d9d37 100644 --- a/Source/UIScrollView+EmptyDataSet.m +++ b/Source/UIScrollView+EmptyDataSet.m @@ -934,6 +934,10 @@ - (void)setupConstraints // If applicable, set the custom view's constraints if (_customView) { + CGFloat topOffset = (self.verticalOffset > 0.0) ? self.verticalOffset : 0.0; + CGFloat bottemOffset = (self.verticalOffset < 0.0) ? -self.verticalOffset : 0.0; + [self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-(topOffset)-[contentView]-(bottemOffset)-|" options:0 metrics:@{@"topOffset":@(topOffset), @"bottemOffset":@(bottemOffset)} views:@{@"contentView": self.contentView}]]; + [self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[customView]|" options:0 metrics:nil views:@{@"customView":_customView}]]; [self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[customView]|" options:0 metrics:nil views:@{@"customView":_customView}]]; }