textview - IOS: Reading RTF file with wrapping text -


i read rtf file code:

nsurl *rtfstring = [[nsbundle mainbundle]urlforresource:@"privacy policy imaspanse" withextension:@"rtf"]; nserror *error; nsmutableattributedstring *stringwithrtfattributes = [[nsmutableattributedstring alloc]initwithfileurl:rtfstring options:@{nsdocumenttypedocumentattribute : nsrtftextdocumenttype} documentattributes:nil error:&error]; if (error) {     nslog(@"error: %@", error.debugdescription); } else {     self.textlabel.attributedtext = stringwithrtfattributes; } self.scrollview.contentsize = [stringwithrtfattributes size]; 

problem long line not wraps next line. how can achieve it? need text screen width , max height

try way

self.textlabel.attributedtext = stringwithrtfattributes; [self.textlabel setnumberoflines:0]; [self.textlabel sizetofit]; [self.textlabel setlinebreakmode:nslinebreakbywordwrapping]; 

Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -