我需要在iOS应用程序中的UITextView中显示来自的一些数据,这是多行的,但是当我在文本视图上使用字符串时,新行不能工作。
下面是我使用的代码:
// 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可能是另一个?
但是,如果我输入字符串,如
// 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中工作。
发布于 2018-08-26 17:58:35
Swift 4:
let stringForUITextView = originJsonString.replacingOccurrences(of: "\\n", with: "\n")https://stackoverflow.com/questions/13028861
复制相似问题