0

I'm pretty new to xcode - so please bear with me!

I'm outputting information from a database to UILabels with information like Name, Region, etc (all good, so far). However - there is a column of text in the database which is all in lowercase (ie flat area to the left)...

The lowercase text looks pretty sucky when it's loaded into the app - so without going into the database and changing all 5000 entries, is there a way to force capitalization programmatically (as is possible in CSS, for example)?

For reference, I'm using the following code in the header file:

IBOutlet UILabel *lblfeatures;

Then in the implementation file:

lblfeatures.text = [self.passedDict objectForKey:@"Feature"];

And linked up through the connections inspector.

Thanks so much :)

Dave
  • 498
  • 2
  • 7
  • 22

2 Answers2

3

You might want to do something like:

lblfeatures.text = [[self.passedDict objectForKey:@"Feature"] capitalizedString];

There are more methods for capitalization described in https://developer.apple.com/library/Mac/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/Reference/NSString.html#//apple_ref/occ/instm/NSString/capitalizedString.

Jernej Strasner
  • 4,590
  • 29
  • 22
  • oh man - it was that simple! Thanks a lot. I find the Mac Developer Library so difficult to plough through - but we're getting there... – Dave Jul 14 '14 at 10:11
  • 1
    @Dave yeah it can be confusing at first, but once you learn how to navigate you see how excellent the documentation is. Especially compared to some other platforms. – Jernej Strasner Jul 14 '14 at 10:14
0

you should use this :

lblfeatures.text= [[NSString stringWithFormat:@"(%@)", [self.passedDict objectForKey:@"Feature"]]capitalizedString];
iBhavin
  • 1,261
  • 15
  • 30