From 86c43a3626b4f007b48035fa6e2266dd1b943387 Mon Sep 17 00:00:00 2001 From: Mark Edward Murray Date: Wed, 26 Oct 2016 12:15:54 -0400 Subject: [PATCH] fix customView UIButton not receiving touch #263 --- Source/UIScrollView+EmptyDataSet.m | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Source/UIScrollView+EmptyDataSet.m b/Source/UIScrollView+EmptyDataSet.m index ce43ffcd..cb335ead 100644 --- a/Source/UIScrollView+EmptyDataSet.m +++ b/Source/UIScrollView+EmptyDataSet.m @@ -736,6 +736,7 @@ - (instancetype)init - (void)didMoveToSuperview { self.frame = self.superview.bounds; + [self.superview bringSubviewToFront:self]; void(^fadeInBlock)(void) = ^{_contentView.alpha = 1.0;}; @@ -921,9 +922,11 @@ - (void)setupConstraints // The content view must alway be centered to its superview NSLayoutConstraint *centerXConstraint = [self equallyRelatedConstraintWithView:self.contentView attribute:NSLayoutAttributeCenterX]; NSLayoutConstraint *centerYConstraint = [self equallyRelatedConstraintWithView:self.contentView attribute:NSLayoutAttributeCenterY]; + NSLayoutConstraint *heightConstraint = [self equallyRelatedConstraintWithView:self.contentView attribute:NSLayoutAttributeHeight]; [self addConstraint:centerXConstraint]; [self addConstraint:centerYConstraint]; + [self addConstraint:heightConstraint]; [self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[contentView]|" options:0 metrics:nil views:@{@"contentView": self.contentView}]]; // When a custom offset is available, we adjust the vertical constraints' constants