8
Not that I know of. I think you'd need to create images of your text labels (either in advance in your graphic tool of choice, or you can create them programmatically at runtime).
If you want to do it programmatically, a method like the following might do it. It creates a center-aligned image using the text you pass it, performing word-wrap.
UITabBarItem *item = [self.tabBar.items objectAtIndex:0];
item.image = [self makeThumbnailFromText:@"Tab Bar One"];
item.title = nil;
item = [self.tabBar.items objectAtIndex:1];
item.image = [self makeThumbnailFromText:@"Tab Bar Two"];
item.title = nil;
This uses a little method that creates a bitmap by rendering the text you pass to it. You might have to play around with image sizes and font sizes to optimize for your tab bar controller images.
- (UIImage *)makeThumbnailFromText:(NSString *)string {
// some variables that control the size of the image we create, what font to use, etc.
CGSize imageSize = CGSizeMake(60, 80);
CGFloat fontSize = 13.0;
NSString *fontName = @"Helvetica-Bold";
UIFont *font = [UIFont fontWithName:fontName size:fontSize];
CGFloat lineSpacing = fontSize * 1.2;
// set up the context and the font
UIGraphicsBeginImageContextWithOptions(imageSize, false, 0);
NSDictionary *attributes = @{NSFontAttributeName: font};
// some variables we use for figuring out the words in the string and how to arrange them on lines of text
NSArray <NSString *> *words = [string componentsSeparatedByString:@" "];
NSMutableArray <NSDictionary *> *lines = [NSMutableArray array];
NSString *lineThusFar;
CGSize sizeThusFar = CGSizeZero;
// let's figure out the lines by examining the size of the rendered text and seeing whether it fits or not and
// figure out where we should break our lines (as well as using that to figure out how to center the text)
for (NSString *word in words) {