158 :(nonnull UITableView *)tableView cellForRowAtIndexPath:(nonnull NSIndexPath *)indexPath {
160 UITableViewCell *cell = nil;
164 cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"usda-pdata-display"];
166 cell.contentView.autoresizingMask = UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth;
167 [cell.layer setCornerRadius:7.0f];
168 [cell.layer setMasksToBounds:YES];
169 [cell.layer setBorderWidth:1.0f];
171 [cell.textLabel setTextColor:[UIColor blackColor]];
172 [cell.textLabel setOpaque:NO];
175 NSInteger nComponents = [focusFoodNutritionArray count];
178 if (nComponents > [indexPath row]) {
180 NSObject *parameterObj = [focusFoodNutritionArray objectAtIndex:[indexPath row]];
181 if ([NSStringFromClass([parameterObj
class]) containsString:
@"Dictionary"]) {
184 NSDictionary *nutrientInfo = (NSDictionary *)parameterObj;
185 NSString *nutriName = [nutrientInfo objectForKey:@"name"];
186 NSString *nutriUnit = [nutrientInfo objectForKey:@"unit"];
187 NSString *nutriValue = [nutrientInfo objectForKey:@"value"];
188 NSString *nutrientEntryString = [NSString stringWithFormat:@"%@ %@", nutriValue, nutriUnit];
197 NSLog(
@"USDAFoodViewController.cellForRow: parameter-obj class: %@", NSStringFromClass([parameterObj
class]));
199 }
else if (0 == nComponents) {
200 cell.textLabel.text =
@"no food data";
instancetype sharedInstance()
Singleton interface to both core and remote data sources.
void labelizeCell:withText:inColor:andDetail:(UITableViewCell *targCell, [withText] NSString *txt, [inColor] UIColor *color, [andDetail] NSString *detailTxt)