iOS Catiledlayer crash

I have a pdf reader app for iPad, I use scroll view to display each page. I keep the page in view and view it on either side of the page One page. I have separate views for portrait and landscape views. The portrait view shows a single page, and the landscape viewer shows 2 pages.

When the iPad changes orientation, I uninstall the view in the old orientation And load the view in the new orientation. So say it is in portrait view and then change to landscape. The application uninstalls the portrait view and loads the landscape view. This all works well, unless the pdf is large.

pdf is used tileslayers is drawn. When the orientation is changed to a large pdf, the application is cleaning up. If the orientation is changed before all the tiles are drawn, the application will only crash. My guess is that it crashed because it tried to convert the tiles Draw to view instead of unloaded. So is there a way to stop drawing tiles when I unload the view?

You need to set the delegate of CALayer to nil, and then delete it from the superview.
This will stop rendering and you can safely release it later.

- (void)stopTiledRenderingAndRemoveFromSuperlayer; {
((CATiledLayer *)[self layer] ).delegate = nil;
[self removeFromSuperview];
[self.layer removeFromSuperlayer];
}

Also, please make sure to call this method from the main thread, Otherwise there may be horrible errors.

I have a pdf reader app for iPad and I use scroll view to display each page. I keep the page In view, and view a page on either side of the page. I have separate views for portrait and landscape views. Portrait view shows a single page, and landscape viewer shows 2 pages.

When When the iPad changes its orientation, I will unload the view in the old orientation and load the view in the new orientation. So say it is in portrait view and then change to landscape. The app unloads the portrait view and loads the landscape view. This all works well, unless the pdf is very good Large.

The pdf is drawn using tileslayers. When the orientation is changed to a large pdf, the application is cleaning up. If the orientation is changed before all the tiles are drawn, the application will only crash. I My guess is that it crashed because it tried to draw the tiles to the view instead of being unloaded. So is there a way to stop drawing the tiles when I unload the view?

You need to set CALayer’s delegate to nil and then remove it from the superview.
This will stop rendering, after which you can safely release .

- (void)stopTiledRenderingAndRemoveFromSuperlayer; {
((CATiledLayer *)[self layer]).delegate = nil;
[self removeFromSuperview];
[self.layer removeFromSuperlayer];
}

Also, make sure to call this method from the main thread, otherwise terrible errors may occur.

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 3865 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.