mirror of
https://github.com/wahyd4/Yep.git
synced 2026-08-18 01:07:44 +10:00
dynamic EditProfileMoreInfoCell's height
This commit is contained in:
@@ -70,4 +70,9 @@ class YepConfig {
|
||||
static let introInset: CGFloat = 20 + userCellAvatarSize + 20 + 11 + 20
|
||||
}
|
||||
|
||||
struct EditProfile {
|
||||
static let introFont = UIFont(name: "Helvetica-Light", size: 15)!
|
||||
static let introInset: CGFloat = 20 + 20
|
||||
}
|
||||
|
||||
}
|
||||
@@ -21,7 +21,10 @@ class EditProfileViewController: UIViewController {
|
||||
let editProfileLessInfoCellIdentifier = "EditProfileLessInfoCell"
|
||||
let editProfileMoreInfoCellIdentifier = "EditProfileMoreInfoCell"
|
||||
let editProfileColoredTitleCellIdentifier = "EditProfileColoredTitleCell"
|
||||
|
||||
|
||||
let intro = "I'm good at iOS Development and Singing. Come here, let me teach you." // TODO: User Intro
|
||||
let introAttributes = [NSFontAttributeName: YepConfig.EditProfile.introFont]
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
@@ -95,7 +98,7 @@ extension EditProfileViewController: UITableViewDataSource, UITableViewDelegate
|
||||
case InfoRow.Intro.rawValue:
|
||||
let cell = tableView.dequeueReusableCellWithIdentifier(editProfileMoreInfoCellIdentifier) as! EditProfileMoreInfoCell
|
||||
cell.annotationLabel.text = NSLocalizedString("Introduction", comment: "")
|
||||
cell.infoLabel.text = "I'm good at iOS Development and Singing. Come here, let me teach you."
|
||||
cell.infoLabel.text = intro
|
||||
return cell
|
||||
|
||||
default:
|
||||
@@ -122,7 +125,14 @@ extension EditProfileViewController: UITableViewDataSource, UITableViewDelegate
|
||||
return 60
|
||||
|
||||
case InfoRow.Intro.rawValue:
|
||||
return 120
|
||||
let tableViewWidth = CGRectGetWidth(editProfileTableView.bounds)
|
||||
let introLabelMaxWidth = tableViewWidth - YepConfig.EditProfile.introInset
|
||||
|
||||
let rect = intro.boundingRectWithSize(CGSize(width: introLabelMaxWidth, height: CGFloat(FLT_MAX)), options: .UsesLineFragmentOrigin | .UsesFontLeading, attributes: introAttributes, context: nil)
|
||||
|
||||
let height = 20 + 22 + 20 + ceil(rect.height) + 20
|
||||
|
||||
return height
|
||||
|
||||
default:
|
||||
return 0
|
||||
|
||||
@@ -17,7 +17,8 @@ class EditProfileMoreInfoCell: UITableViewCell {
|
||||
|
||||
override func awakeFromNib() {
|
||||
super.awakeFromNib()
|
||||
// Initialization code
|
||||
|
||||
infoLabel.font = YepConfig.EditProfile.introFont
|
||||
}
|
||||
|
||||
override func setSelected(selected: Bool, animated: Bool) {
|
||||
|
||||
Reference in New Issue
Block a user