@@ -51,14 +51,27 @@ - (id)initWithStyle:(UITableViewStyle)style
5151- (void )viewDidLoad
5252{
5353 [super viewDidLoad ];
54+
5455 [self .tableView registerClass: [RJTableViewCell class ] forCellReuseIdentifier: CellIdentifier];
56+ }
5557
56- // Uncomment the following line to preserve selection between presentations.
57- // self.clearsSelectionOnViewWillAppear = NO;
58-
59- // Uncomment the following line to display an Edit button in the navigation bar for this view controller.
60- // self.navigationItem.rightBarButtonItem = self.editButtonItem;
58+ - (void )viewDidAppear : (BOOL )animated
59+ {
60+ [super viewDidAppear: animated];
61+
62+ [[NSNotificationCenter defaultCenter ] addObserver: self
63+ selector: @selector (contentSizeCategoryChanged: )
64+ name: UIContentSizeCategoryDidChangeNotification
65+ object: nil ];
66+ }
67+
68+ - (void )viewDidDisappear : (BOOL )animated
69+ {
70+ [super viewDidDisappear: animated];
6171
72+ [[NSNotificationCenter defaultCenter ] removeObserver: self
73+ name: UIContentSizeCategoryDidChangeNotification
74+ object: nil ];
6275}
6376
6477- (void )didReceiveMemoryWarning
@@ -67,6 +80,11 @@ - (void)didReceiveMemoryWarning
6780 // Dispose of any resources that can be recreated.
6881}
6982
83+ - (void )contentSizeCategoryChanged : (NSNotification *)notification
84+ {
85+ [self .tableView reloadData ];
86+ }
87+
7088#pragma mark - Table view data source
7189
7290- (NSInteger )numberOfSectionsInTableView : (UITableView *)tableView
@@ -86,7 +104,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
86104
87105 RJTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier: CellIdentifier forIndexPath: indexPath];
88106
89- // Configure the cell...
107+ [ cell updateFonts ];
90108
91109 NSDictionary *dataSourceItem = [self .model.dataSource objectAtIndex: indexPath.row];
92110
@@ -104,6 +122,8 @@ - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPa
104122
105123 RJTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier: CellIdentifier];
106124
125+ [cell updateFonts ];
126+
107127 NSDictionary *dataSourceItem = [self .model.dataSource objectAtIndex: indexPath.row];
108128 cell.titleLabel .text = [dataSourceItem valueForKey: @" title" ];
109129 cell.bodyLabel .text = [dataSourceItem valueForKey: @" body" ];
@@ -122,9 +142,7 @@ - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPa
122142
123143- (CGFloat)tableView : (UITableView *)tableView estimatedHeightForRowAtIndexPath : (NSIndexPath *)indexPath
124144{
125-
126145 return 500 .0f ;
127-
128146}
129147
130148/*
0 commit comments