diff --git a/Demo/WhisperDemo/WhisperDemo.xcworkspace/xcuserdata/RamonGilabert.xcuserdatad/UserInterfaceState.xcuserstate b/Demo/WhisperDemo/WhisperDemo.xcworkspace/xcuserdata/RamonGilabert.xcuserdatad/UserInterfaceState.xcuserstate index d24ff20..706039e 100644 Binary files a/Demo/WhisperDemo/WhisperDemo.xcworkspace/xcuserdata/RamonGilabert.xcuserdatad/UserInterfaceState.xcuserstate and b/Demo/WhisperDemo/WhisperDemo.xcworkspace/xcuserdata/RamonGilabert.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/Source/WhisperFactory.swift b/Source/WhisperFactory.swift index b024c17..38b9b8c 100644 --- a/Source/WhisperFactory.swift +++ b/Source/WhisperFactory.swift @@ -99,6 +99,11 @@ class WhisperFactory: NSObject { self.whisperView.frame.size.height = WhisperView.Dimensions.height for subview in self.whisperView.transformViews { subview.frame.origin.y = 0 + + if subview == self.whisperView.complementImageView { + subview.frame.origin.y = (WhisperView.Dimensions.height - WhisperView.Dimensions.imageSize) / 2 + } + subview.alpha = 1 } }) @@ -111,6 +116,11 @@ class WhisperFactory: NSObject { self.whisperView.frame.size.height = WhisperView.Dimensions.height for subview in self.whisperView.transformViews { subview.frame.origin.y = 0 + + if subview == self.whisperView.complementImageView { + subview.frame.origin.y = (WhisperView.Dimensions.height - WhisperView.Dimensions.imageSize) / 2 + } + subview.alpha = 1 } }, completion: { _ in @@ -191,8 +201,8 @@ class WhisperFactory: NSObject { edgeInsetHeight = down ? WhisperView.Dimensions.height : -WhisperView.Dimensions.height UIView.animateWithDuration(AnimationTiming.movement, animations: { - self.performControllerMove(visibleController) - }) + self.performControllerMove(visibleController) + }) } func performControllerMove(viewController: UIViewController) { diff --git a/Source/WhisperView.swift b/Source/WhisperView.swift index b8048bf..95db8d3 100644 --- a/Source/WhisperView.swift +++ b/Source/WhisperView.swift @@ -16,7 +16,7 @@ public class WhisperView: UIView { lazy private(set) var transformViews: [UIView] = [self.titleLabel, self.complementImageView] - lazy var titleLabel: UILabel = { + public lazy var titleLabel: UILabel = { let label = UILabel() label.textAlignment = .Center label.textColor = UIColor.whiteColor() @@ -60,6 +60,7 @@ public class WhisperView: UIView { titleLabel.sizeToFit() setupFrames() + clipsToBounds = true } public required init?(coder aDecoder: NSCoder) { @@ -80,11 +81,10 @@ extension WhisperView { height: frame.height) complementImageView.frame = CGRect( - x: titleLabel.frame.origin.y - Dimensions.imageSize - Dimensions.loaderTitleOffset, - y: (frame.height - Dimensions.imageSize) / 2, + x: titleLabel.frame.origin.x - Dimensions.imageSize - Dimensions.loaderTitleOffset, + y: (Dimensions.height - Dimensions.imageSize) / 2, width: Dimensions.imageSize, height: Dimensions.imageSize) - } else { titleLabel.frame = CGRect( x: (frame.width - titleLabel.frame.width) / 2,