Skip to content

Commit 276d1ff

Browse files
committed
Fixed avatar controller appearance.
1 parent 479dd2a commit 276d1ff

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

NativeUIKit.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Pod::Spec.new do |s|
22

33
s.name = 'NativeUIKit'
4-
s.version = '1.2.8'
4+
s.version = '1.2.9'
55
s.summary = 'Mimicrated views and controls to native Apple appearance.'
66
s.homepage = 'https://github.com/ivanvorobei/NativeUIKit'
77
s.source = { :git => 'https://github.com/ivanvorobei/NativeUIKit.git', :tag => s.version }

Sources/NativeUIKit/Controllers/Complex/Profile/NativeProfileHeaderView.swift

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ open class NativeProfileHeaderView: SPView {
5959
// $0.titleLabel?.adjustsFontSizeToFitWidth = true
6060
// $0.titleLabel?.minimumScaleFactor = 0.5
6161
$0.titleImageInset = 2
62+
$0.titleLabel?.textAlignment = .center
6263
}
6364

6465
// MARK: - Private
@@ -117,15 +118,20 @@ open class NativeProfileHeaderView: SPView {
117118
avatarView.setXCenter()
118119
avatarView.frame.origin.y = layoutMargins.top
119120

120-
nameLabel.layoutDynamicHeight(width: layoutWidth)
121+
let textWidth: CGFloat = layoutWidth * 0.8
122+
123+
nameLabel.layoutDynamicHeight(width: textWidth)
121124
nameLabel.setXCenter()
122125
nameLabel.frame.origin.y = avatarView.frame.maxY + NativeLayout.Spaces.default_half
123126

124-
namePlaceholderLabel.layoutDynamicHeight(width: layoutWidth)
127+
namePlaceholderLabel.layoutDynamicHeight(width: textWidth)
125128
namePlaceholderLabel.setXCenter()
126129
namePlaceholderLabel.frame.origin.y = nameLabel.frame.origin.y
127130

128131
emailButton.sizeToFit()
132+
if emailButton.frame.width > textWidth {
133+
emailButton.frame.setWidth(textWidth)
134+
}
129135
emailButton.setXCenter()
130136
emailButton.frame.origin.y = usingNameLabel.frame.maxY
131137
}

0 commit comments

Comments
 (0)