0

I am displaying text on a UILABEL from XML, I am getting CRLF's in the text.So i am not able to append the new lines for my label.This is the code i tried.But iam not getting PLease help me in this

 NSArray* array = [subHead.Description componentsSeparatedByString:@"\r\n"]; NSLog(@"Count : %d",[array count]); for(int i=0;i<[array count];i++) { NSLog(@"%@",[array objectAtIndex:i]); NSString* s = [NSString stringWithFormat:@"%@",[array objectAtIndex:i]]; // s = [s stringByTrimmingCharactersInSet:[NSCharacterSet controlCharacterSet]]; if ([s length]>0){ [str appendString:[array objectAtIndex:i]]; [str appendString:@"\r\n"];flag++; }else { NSLog(@"Two \n\'s are occured"); } NSLog(@"Flag value : %d",flag); } NSLog(@"String : %@",str); NSLog(@"Description : %@",subHead.Description); subheadlabel.text=str; 

THANKS IN ADVANCE

1 Answer 1

0

set yourLabel.numberOfLines = 0;

follow How to add line break for UILabel? link you will get idea how it works.

This should help you.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.