html - CoreTextView & UIScrollview : Calculating window size -


i using coretextview on ios render html file in uiscrollview set programmatically. html file exceeds length, text no longer renders. not seem problem with:

  • memory. nslog displays entire nsattributedstring no matter how long is.

  • a formatting error in html file. able render entire file in pieces.

if put in large height frame, same thing: empty screen , no errors troubleshoot. suspect issue has calculating file size , maybe... font line size? stumped. incidentally, if enter custom font, ignored , default helvetica displayed. font sizes, however, render correctly. on getting entire file display appreciated!

my code:

m_coretext = [[coretextview alloc] initwithframe:cgrectzero]; m_coretext.backgroundcolor = [uicolor clearcolor]; m_coretext.contentinset = uiedgeinsetsmake(10, 10, 10, 10);  nsstring* html = [nsstring stringwithcontentsoffile:[[nsbundle mainbundle] pathforresource:@"terms" oftype:@"html"] encoding:nsutf8stringencoding error:null]; m_coretext.attributedstring = [nsattributedstring attributedstringwithhtml:html renderer:^id<htmlrenderer>(nsmutabledictionary* attributes) {                                  customrenderer* renderer=[[customrenderer alloc] init];                                  renderer.type=attributes[@"type"];                                  renderer.size=cgsizemake(16, 16);                                  return renderer;                              }]; m_coretext.frame = cgrectmake(0, 0, self.view.bounds.size.width, [m_coretext sizethatfits:cgsizemake(self.view.bounds.size.width, maxfloat)].height);  uiscrollview* scroll = [[uiscrollview alloc] initwithframe:self.view.bounds]; scroll.autoresizingmask=uiviewautoresizingflexiblewidth|uiviewautoresizingflexibleheight; scroll.contentsize=m_coretext.frame.size; [scroll addsubview:m_coretext]; [self.view addsubview:scroll];    


Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -