iphone - Why is UIView drawRect causing first pass of UIScrollview to be choppy/jerky/slow? -


edit: looks problem code in procedural background drawing in uiview adding subview uiscrollview. procedural code below. draws box shapes, sort of skyline. ideas why slowing down first pass of uiscrollview? can as thousand pixels wide or more @ times. see image...

- (void)drawrect:(cgrect)rect { uibezierpath *vertline = [[uibezierpath alloc] init];  [vertline movetopoint:cgpointmake(0,self.frame.size.height)];  int detail = 10; int rannum = 0; int count = self.bounds.size.width/detail; cgfloat heightincrement = 0.0;  cgfloat minheight = self.frame.size.height;  cgfloat xpos = 0; cgfloat ypos = self.frame.size.height-20;  (int =0; i<count; i++) {     rannum += (arc4random() % 9)-5;      ypos -= (arc4random() % 30);     [vertline addlinetopoint:cgpointmake(xpos,ypos)];      xpos += (arc4random() % 20)+10;     [vertline addlinetopoint:cgpointmake(xpos,ypos)];      ypos += (arc4random() % 30);     [vertline addlinetopoint:cgpointmake(xpos,ypos)];      xpos += (arc4random() % 30);     [vertline addlinetopoint:cgpointmake(xpos,ypos)];      if (ypos>self.frame.size.height-10) {         ypos = self.frame.size.height-10;     }      if (ypos<self.frame.size.height-50) {         ypos = self.frame.size.height-50;     }  }  [vertline addlinetopoint:cgpointmake(count*20,(self.frame.size.height))];  [[uicolor colorwithred:0.0/255.0 green:38.0/255.0 blue:51.0/255 alpha:1] setfill];  [vertline fill];  } 

procedural background drawn in drawrect causing slow uiscrollview

have jerky scroll view, on first pass. after views have been viewed in scroll view, smooth.

first pass: during first pass appears when each uiimageview coming view (from right left) there jerk right when entering visible area. if reference attached image, you'll see uiimageview 5 entering right left. when happens there small pause if scroll view telling image view load/prepare on stage. have tried profile don't see problems in code , im not sure how can profile methods etc. have not overridden. sub question be... methods called on subview of uiscrollview when entering visible area?

as mention tried async , other concurrent approaches, seems no matter how images loaded, first pass jerky, if uiscrollview caches subviews. possible caching/loading front... [scrollview cachesubviews]; rather have slower startup clunky on first scroll.

thanks ideas on or information how uiscrollview works subviews. have seen many questions , solutions jerky uiscrollviews uiimageviews subviews. have tried many of them, still have slow scrollview. austin

imagewithcontentsoffile synchronous process takes lot of tile.use asynchronous way load images , smoothness can achieved


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -