diff --git a/GHFollowers.xcodeproj/project.xcworkspace/xcuserdata/vasilis.xcuserdatad/UserInterfaceState.xcuserstate b/GHFollowers.xcodeproj/project.xcworkspace/xcuserdata/vasilis.xcuserdatad/UserInterfaceState.xcuserstate index 882ed2d..670dea4 100644 Binary files a/GHFollowers.xcodeproj/project.xcworkspace/xcuserdata/vasilis.xcuserdatad/UserInterfaceState.xcuserstate and b/GHFollowers.xcodeproj/project.xcworkspace/xcuserdata/vasilis.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/GHFollowers/Components/ViewControllers/GFDataLoadingVC.swift b/GHFollowers/Components/ViewControllers/GFDataLoadingVC.swift index dfe53be..359b694 100644 --- a/GHFollowers/Components/ViewControllers/GFDataLoadingVC.swift +++ b/GHFollowers/Components/ViewControllers/GFDataLoadingVC.swift @@ -35,8 +35,8 @@ class GFDataLoadingVC: UIViewController { // center indicator on containerView NSLayoutConstraint.activate([ - activityIndicator.centerYAnchor.constraint(equalTo: view.centerYAnchor), - activityIndicator.centerXAnchor.constraint(equalTo: view.centerXAnchor) + activityIndicator.centerYAnchor.constraint(equalTo: containerView.centerYAnchor), + activityIndicator.centerXAnchor.constraint(equalTo: containerView.centerXAnchor) ]) activityIndicator.startAnimating() diff --git a/GHFollowers/Components/Views/GFEmptyStateView.swift b/GHFollowers/Components/Views/GFEmptyStateView.swift index caeb086..fb7a366 100644 --- a/GHFollowers/Components/Views/GFEmptyStateView.swift +++ b/GHFollowers/Components/Views/GFEmptyStateView.swift @@ -15,7 +15,7 @@ class GFEmptyStateView: UIView { override init(frame: CGRect) { super.init(frame: frame) - configure() + configureUI() } required init?(coder: NSCoder) { @@ -29,33 +29,50 @@ class GFEmptyStateView: UIView { } - private func configure() { - + private func configureUI() { + configureMessageLabel() + configureLogoImageView() + } + + + private func configureMessageLabel() { addSubview(messageLabel) - addSubview(logoImageView) - messageLabel.numberOfLines = 3 messageLabel.textColor = .secondaryLabel - logoImageView.image = Images.emptyStateLogo - logoImageView.translatesAutoresizingMaskIntoConstraints = false + //center item on screen verrtically and then push up a litle bit + let labelCenterYConstant: CGFloat = DeviceTypes.isiPhoneSE || DeviceTypes.isiPhone8Zoomed ? -80 : -150 + let messageLabelCenterYConstraint = messageLabel.centerYAnchor.constraint(equalTo: self.centerYAnchor, constant: labelCenterYConstant) + messageLabelCenterYConstraint.isActive = true NSLayoutConstraint.activate([ - //center item on screen verrtically and then push up a litle bit - messageLabel.centerYAnchor.constraint(equalTo: self.centerYAnchor, constant: -150), messageLabel.leadingAnchor.constraint(equalTo: self.leadingAnchor, constant: 40), messageLabel.trailingAnchor.constraint(equalTo: self.trailingAnchor, constant: -40), // hard code height since we know the text message already messageLabel.heightAnchor.constraint(equalToConstant: 200), + ]) + } + + + + private func configureLogoImageView() { + addSubview(logoImageView) + logoImageView.image = Images.emptyStateLogo + logoImageView.translatesAutoresizingMaskIntoConstraints = false + + let logoBottomConstant: CGFloat = DeviceTypes.isiPhoneSE || DeviceTypes.isiPhone8Zoomed ? 80 : 40 + let logoImageViewBottomConstraint = logoImageView.bottomAnchor.constraint(equalTo: self.bottomAnchor, constant: logoBottomConstant) + logoImageViewBottomConstraint.isActive = true + + NSLayoutConstraint.activate([ // take the image and make it 1.3 times larger then it curretn width (scale: 1.3) logoImageView.widthAnchor.constraint(equalTo: self.widthAnchor, multiplier: 1.3), // make height same as width (height will be 1.3 times larger) logoImageView.heightAnchor.constraint(equalTo: self.widthAnchor, multiplier: 1.3), // we use 200 to push the element TOWARDS the edge and not pull it like we did any other time - logoImageView.trailingAnchor.constraint(equalTo: self.trailingAnchor, constant: 170), + logoImageView.trailingAnchor.constraint(equalTo: self.trailingAnchor, constant: 170) // same as above (push insted of pull) so not using a negative number in constant - logoImageView.bottomAnchor.constraint(equalTo: self.bottomAnchor, constant: 40) ]) }