iphone - sectionName TableView - What am I doing wrong? -
i'm having trouble changing colour , font on tableview have split 4 sections names etc., can;t seem work i'm not sure doing wrong?
- (nsstring *)tableview:(uitableview *)tableview viewforheaderinsection:(nsinteger)section { nsstring *sectionname = nil; switch(section) { case 0: sectionname = [nsstring stringwithstring:@"date"]; break; case 1: sectionname = [nsstring stringwithstring:@"gig"]; break; case 2: sectionname = [nsstring stringwithstring:@"city"]; break; case 3: sectionname = [nsstring stringwithstring:@"country"]; break; } uilabel *sectionheader = [[[uilabel alloc] initwithframe:cgrectmake(0, 0, 200, 40)] autorelease]; sectionheader.backgroundcolor = [uicolor clearcolor]; sectionheader.font = [uifont boldsystemfontofsize:18]; sectionheader.textcolor = [uicolor whitecolor]; sectionheader.text = sectionname; return sectionname; }
you should return view instead of string...
this returning
return sectionname;
and should return..
return sectionheader;
Comments
Post a Comment