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

ask123
  • 217
  • 6
  • 15

1 Answers1

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.

Community
  • 1
  • 1
Janak Nirmal
  • 22,706
  • 18
  • 63
  • 99