MotionInMotion Episode 13 - Dynamic Type
フォントサイズの変更
- PostsControllerTableViewDataSource
- app/data_sources/PostsControllerTableViewDataSource.rb
- cell.textLabel.font = UIFont.preferredFontForTextStyle(UIFontTextStyleHeadline)
- Headline, SubHeadline, Body, Footnote, Caption1, Caption2
- Settings > General > Font Size
- PostsControllerTableViewDelegate
- tableView(tableView, heightForRowAtIndexPath:
- ("Reference Text".sizeWithFont(UIFont.preferredFontForTextStyle(UIFontTextStyleHeadline)).height * 1.5)
- tableView(tableView, heightForRowAtIndexPath:
- NSNotificationCenter.defaultCenter
- .addObserver font_changed UIContentSizeCategoryDidChangeNotification
- controller
- include PostsControllerTableViewDataSource
- include PostsControllerTableViewDelegate
- font_changed
- self.tableView.reloadData
- view
- font_changed
- self.contentView.font = UIFont.preferredFontForTextStyle(UIFontTextStyleBody)
- self.authorAreaLabel.font = UIFont.preferredFontForTextStyle(UIFontTextStyleHeadline)
- font_changed