0

I have been working on tHe plist in iOS.I have saved font style Marker Felt Thin 25.0 as string in plist.

Now i want to retrieve that string and assign font to the my tableview cell text.

while i am trying is not affecting the cell why is it so...?

NSString *path = [[NSBundle mainBundle] pathForResource:@"myPlist" ofType:@"plist"];

// Load the file content and read the data into arrays

NSMutableDictionary *dict = [[NSMutableDictionary alloc] initWithContentsOfFile:path];

cell.textLabel.font=[UIFont fontWithName:[[dict objectForKey:@"Font"]size:15]];

How can i do it...?

here is the plist screenshot

PList[2423:126298] { Names = ( Ajith, Bhuvan, Carrie, David, Ezzel, Farroq, Quresema, Ganesh, Harris, Imman, Jagadish, Kevin, Lucy, Manoj, Nathan, Oram, Pawan, Remy, San, Tanu, Urmilla, Vidya, Watson, Xabi, Yamini, Zaheer ); font = "Marker Felt Thin "; } Dictionary Values

remyr3my
  • 768
  • 1
  • 6
  • 19

2 Answers2

1

The dictionary key is font and not Font. Keys are case-sensitive.

Use:

 cell.textLabel.font = [UIFont fontWithName:dict[@"font"] size:15];
Droppy
  • 9,691
  • 1
  • 20
  • 27
0

I think your problem is with the line

cell.textLabel.font=[UIFont fontWithName:[[dict objectForKey:@"Font"]size:15]];

It might be like this :

cell.textLabel.font = [UIFont fontWithName:[dict objectForKey:@"Font"] size:15]];
Ashish Thakkar
  • 944
  • 8
  • 27
Vishal Sonawane
  • 2,637
  • 2
  • 16
  • 21