ios - Subtitle not appearing UITableView cell -


i new app designing , objective-c. writing simple food app has food stored in array details of food, food name, cook time , file name leads picture.

i trying subtitle work isn't showing up. i've read various other posts , have tried implement of answers none have worked.

this code if there incorrect please let me know. thank you.

-(uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath{      static nsstring *cellidentifier = @"foodcell";     uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier forindexpath:indexpath];     if (cell == nil){         cell = [[uitableviewcell alloc]initwithstyle:uitableviewcellstylesubtitle reuseidentifier:cellidentifier];     }      food *current = [foodarray objectatindex:indexpath.row];       [cell.textlabel settext:[current name]];     [[cell detailtextlabel] settext:@[current cooktime]];     cell.imageview.image = [uiimage imagenamed:[current filename]];      return cell; } 

replace

[[cell detailtextlabel] settext:@[current cooktime]]; 

with

[[cell detailtextlabel] settext:[current cooktime]]; 

note assumes cooktime nsstring. if else, integer representing minutes, this:

[[cell detailtextlabel] settext:[nsstring stringwithformat:@"%d minutes", [current cooktime]]]; 

additionally, may find easier use format:

cell.detailtextlabel.text = [nsstring stringwithformat:@"%d minutes", [current cooktime]]; 

Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -