ios - Scrollview with images still crashes even lazy load? -


i have scroll view holding few images, each 1 around 100kb. add them uiscrollview creating uiviewcontrollers hold them. controllers stored in scrollview. remove view superview , replace string when image scrolls out of visible area. think i'm doing fine. still got crash after scrolling few times(even scroll forth , on same 5 images).

i noticed every controller's dealloc called when it's removed scroll view, not viewdidunload.

any appreciated.

viewdidunload called when viewcontroller released view. not called if you released view (which means viewdidunload relevant in memory warning situation). in order delete view , view controller, should remove view superview, release view controller. it's normal viewdidunload not called.

it's hard understand how implemented this, , why went wrong. let me suggest few things.

the view controller's methods such viewwillappear, viewdidappear, viewwilldisappear, viewdiddisappear, etc. not useful here, because none of them can tell view on screen or not. way can tell contentoffset of scroll view every time scroll happens (by delegate methods of uiscrollviewdelegate), , check if views on visible region or not.

therefore, it's not necessary use uiviewcontroller there. use views, example uiimageview. dynamically create instance of view when it's visible, or more desirably, when it's near visible area.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -