2011-04-19 56 views
0

我在XML中的UILABEL上顯示文本,我在文本中獲取CRLF。所以我無法爲我的標籤附加新行。這是我試過的代碼。但是IAM沒有得到 請幫我在這如何在我的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; 

在此先感謝

回答

相關問題