Monday, January 23, 2012

UILabel/UIButton not showing text - iPhone 4

If the text is showing perfectly fine in other devices, first thing I would check is the font assigned. There is a small issue with the new Xcode version (version 4.2). Some of the fonts you get in the IB (Interface Builder) are not available in all iOS versions and devices. For example the font "Helvetica Neue Medium" is not available in iPhone 4 running iOS 4.3.5

The same problem (UILabel/UIButton not showing text) happened to me because of this font issue. Changing "Medium" to "Regular" was my fix. If you are looking for a font list, you can get it by executing following code.

for( NSString *familyName in [UIFont familyNames] ) {
for( NSString *fontName in [UIFont fontNamesForFamilyName:familyName] ) {
NSLog(@"%@", fontName);
}
}

2 comments:

Anonymous said...

thanks a lot for your post. It fixed the problem which puzzled me for some time. glad I came across this post.

Ramesh Aran said...

Hi Yaar ,,,,,


Thanks a lot .... It saved my time.