I am downloading UITextView contents from a web server and it just returns text without any line feeds. I inserted \n
, \\n
, [CR]
, and more into the place I want to change the line but none of these worked. How can I change the line for the text in UITextView?
Weird. Works for me.
_subtypeField = [[UITextView alloc] initWithFrame:CGRectMake(28, 189, self.bounds.size.width-30, 100)];
[_subtypeField setFont:[UIFont fontWithName:@"Helvetica" size:13]];
[_subtypeField setText:@"Examples:\n- Fentanyl\n- Dilaudid 2 mg PO q 4 hours prn moderate pain"];
[_subtypeField setTextAlignment:UITextAlignmentLeft];
[_subtypeField setTextColor:[UIColor colorWithRed:0.494 green:0.647 blue:0.808 alpha:1.0]];
[_subtypeField setOpaque:NO];
[_subtypeField setBackgroundColor:[UIColor clearColor]];
[_subtypeField setUserInteractionEnabled:NO];
[self addSubview:_subtypeField];
Perhaps something goes wrong when you convert the C string into an NSString? Are the linefeeds still in the NSString?