我需要在UITextView中顯示一些JSON Webservice中的數據,這些數據是多行的,但是當我在textview上使用字符串時,新行不起作用。iOS UITextView忽略來自JSON響應的換行符
這裏是代碼我使用:
// Data Value from JSON = testing the data value \r\n Another \n liine maybe?
NSString *responseDataString = [dictRequestorDetails objectForKey:@"data"];
txtWorkflowDetails.text = responseDataString;
當我執行這個代碼的UITextField顯示
測試數據值\ r \ n另外\ n liine可能?
但是如果我在字符串中像
// Data Value from JSON = testing the data value \r\n Another \n liine maybe?
NSString *responseDataString = [dictRequestorDetails objectForKey:@"data"];
txtWorkflowDetails.text = @"testing the data value \r\n Another \n liine maybe?";
鍵入換行符然後在TextView的工作