2011-04-19 5 views
0

XML에서 UILABEL에 텍스트를 표시하고 있습니다. CRLF가 텍스트에 있습니다. 내 레이블에 새 줄을 추가 할 수 없습니다.이 코드는 시도했습니다.하지만 스피가 사전에이내 UILABEL에 CRLF를 추가하는 방법

   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; 

감사에서 저를 도와주세요 을받지

답변

0

설정 yourLabel.numberOfLines = 0;

링크를 따라 가면 How to add line break for UILabel? 링크를 통해 어떻게 작동하는지 알 수 있습니다.

도움이 될 것입니다.

관련 문제