{"action":"opened","issue":{"url":"https://api.github.com/repos/TTTAttributedLabel/TTTAttributedLabel/issues/566","labels_url":"https://api.github.com/repos/TTTAttributedLabel/TTTAttributedLabel/issues/566/labels{/name}","comments_url":"https://api.github.com/repos/TTTAttributedLabel/TTTAttributedLabel/issues/566/comments","events_url":"https://api.github.com/repos/TTTAttributedLabel/TTTAttributedLabel/issues/566/events","html_url":"https://github.com/TTTAttributedLabel/TTTAttributedLabel/issues/566","id":98657963,"number":566,"title":"Setting textInsets breaks sizing, sizeThatFits returns incorrect height.","user":{"login":"zkhalapyan","id":796815,"avatar_url":"https://avatars.githubusercontent.com/u/796815?v=3","gravatar_id":"","url":"https://api.github.com/users/zkhalapyan","html_url":"https://github.com/zkhalapyan","followers_url":"https://api.github.com/users/zkhalapyan/followers","following_url":"https://api.github.com/users/zkhalapyan/following{/other_user}","gists_url":"https://api.github.com/users/zkhalapyan/gists{/gist_id}","starred_url":"https://api.github.com/users/zkhalapyan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zkhalapyan/subscriptions","organizations_url":"https://api.github.com/users/zkhalapyan/orgs","repos_url":"https://api.github.com/users/zkhalapyan/repos","events_url":"https://api.github.com/users/zkhalapyan/events{/privacy}","received_events_url":"https://api.github.com/users/zkhalapyan/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-08-03T02:28:52Z","updated_at":"2015-08-03T02:28:52Z","closed_at":null,"body":"When the label's `textInsets` property is set, the size returned by `sizedThatFits` is shorter and the label truncates the last line; the issue doesn't reproduce if `textInsets` is set to `CGRectZero`.  See below screenshot of the truncated and untruncated labels: \r\n\r\n![screen shot 2015-08-02 at 7 18 54 pm](https://cloud.githubusercontent.com/assets/796815/9029669/73a8eac8-394c-11e5-8b57-76032192c128.png)\r\n\r\n![screen shot 2015-08-02 at 7 19 20 pm](https://cloud.githubusercontent.com/assets/796815/9029679/84363800-394c-11e5-909b-e2f15a7942b9.png)\r\n\r\n\r\n```\r\n// Code constructing the NSAttributedString.\r\nprivate func DWAppFlowControllerNotificationsViewControllerFooterView() -> UIView {\r\n  let upgradeNotice:String = \"To turn on all notifications, subscribe to our monthly \" +\r\n    \"subscription service ($0.99/month). If you have already subscribed, please restore your purchase.\"\r\n  let font:UIFont = UIFont(name:\"HelveticaNeue-Light\", size:14)!\r\n  let paragraphStyle = NSMutableParagraphStyle()\r\n  paragraphStyle.lineHeightMultiple = 1.2\r\n  \r\n  let upgradeNoticeAttributedString = NSAttributedString(string:upgradeNotice, attributes: [\r\n    NSFontAttributeName: font,\r\n    NSParagraphStyleAttributeName: paragraphStyle,\r\n    NSForegroundColorAttributeName: UIColor.grayColor().CGColor,\r\n  ])\r\n  let upgradeNoticeLinkAttributes = [\r\n    NSForegroundColorAttributeName: UIColor(hex:0x007AFF),\r\n    NSUnderlineStyleAttributeName: NSNumber(bool:false),\r\n  ]\r\n\r\n  let upgradeNoticeLabel = TTTAttributedLabel(frame:CGRectZero)\r\n  upgradeNoticeLabel.numberOfLines = 0\r\n  upgradeNoticeLabel.lineBreakMode = NSLineBreakMode.ByWordWrapping\r\n  upgradeNoticeLabel.textInsets = UIEdgeInsets(top:15, left:10, bottom:15, right:10)\r\n  upgradeNoticeLabel.setText(upgradeNoticeAttributedString) \r\n  upgradeNoticeLabel.linkAttributes = upgradeNoticeLinkAttributes\r\n  \r\n  let subscribeLinkRange = (upgradeNotice as NSString).rangeOfString(\"subscribe\")\r\n  let subscribeURL = NSURL(string:\"action://subscribe\")!\r\n  upgradeNoticeLabel.addLinkToURL(subscribeURL, withRange:subscribeLinkRange)\r\n\r\n  let restoreLinkRange = (upgradeNotice as NSString).rangeOfString(\"restore\")\r\n  let restoreURL = NSURL(string:\"action://restore\")!\r\n  upgradeNoticeLabel.addLinkToURL(restoreURL, withRange:restoreLinkRange)\r\n\r\n  return upgradeNoticeLabel\r\n}\r\n```\r\n\r\n```\r\n// Code heighting the NSAttributedString; the width is correctly set to the width of the view.\r\npublic func tableView(tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {\r\n  if (section == notificationSections.count - 1) {\r\n    let notificationSectionsFooterViewSize:CGSize = notificationSectionsFooterView!.sizeThatFits(self.view.bounds.size)\r\n    return notificationSectionsFooterViewSize.height\r\n  }\r\n  return UITableViewAutomaticDimension\r\n}\r\n```\r\n\r\n"}}