ios - change navigation bar title's color -


i know how change color of navigation bar title when write code:

uilabel * label = [[[uilabel alloc] initwithframe:cgrectmake(0,0,45,45)] autorelease]; label.textcolor = [uicolor yellowcolor]; label.backgroundcolor=[uicolor clearcolor];  self.navigationitem.titleview = label; label.text=@"title"; //custom title [label sizetofit]; 

i want navigation bar show cell's title, not custom title.

here table view code:

-(nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section {     return ghazallist.count; }  - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath {      static nsstring *simpletableidentifier = @"simpletableidentifier";       uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:simpletableidentifier];      if (cell == nil) {          cell = [[[uitableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:simpletableidentifier] autorelease];      }       nsuinteger row = [indexpath row];      cell.textlabel.text = [ghazallist objectatindex:row];     return cell;  }  

based on explanation, try

uilabel * label = [[[uilabel alloc] initwithframe:cgrectmake(0,0,45,45)] autorelease]; label.textcolor = [uicolor yellowcolor]; label.backgroundcolor = [uicolor clearcolor];  label.text = self.navigationitem.title; self.navigationitem.titleview = label; [label sizetofit]; 

Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -