diff --git a/Yep/Configs/YepConfig.swift b/Yep/Configs/YepConfig.swift index eced1e0d..624e75da 100644 --- a/Yep/Configs/YepConfig.swift +++ b/Yep/Configs/YepConfig.swift @@ -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 + } + } \ No newline at end of file diff --git a/Yep/ViewControllers/EditProfile/EditProfileViewController.swift b/Yep/ViewControllers/EditProfile/EditProfileViewController.swift index b83e4587..d437c560 100644 --- a/Yep/ViewControllers/EditProfile/EditProfileViewController.swift +++ b/Yep/ViewControllers/EditProfile/EditProfileViewController.swift @@ -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 diff --git a/Yep/Views/Cells/EditProfileMoreInfo/EditProfileMoreInfoCell.swift b/Yep/Views/Cells/EditProfileMoreInfo/EditProfileMoreInfoCell.swift index 0dfefbbd..3cdad17d 100644 --- a/Yep/Views/Cells/EditProfileMoreInfo/EditProfileMoreInfoCell.swift +++ b/Yep/Views/Cells/EditProfileMoreInfo/EditProfileMoreInfoCell.swift @@ -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) {