Search code examples
iosobjective-cuilabelright-to-lefthebrew

assigning english and hebrew text to same uilabel


I am maintaining an existing iOS project. I have to update text of a uilabel with half english text and half hebrew.

NSString *tempStr=[[LanguageManager sharedManager]languageString:@"Helpo Rank"];
self.rankLabel.text=@"";
NSLog(@"Helpo Rank assigned from .txt ---->%@",tempStr);
self.rankLabel.text=[NSString stringWithFormat:@"%@:%@",tempStr,[self.professionalDetailDict objectForKey:@"ranking"]];

but the output beomes messy.output


Solution

  • One option is to use 3 ui labels:

    The first is the localized string The second is the separator The third is the rank in numbers

    That way the labels will be visually flipped automatically when layout changes from LTR to RTL and vice verse..

    There is another workaround if you'll like