ios - Why set scrollview's delegate to nil in dealloc method? -
i found when slide tableview pressed button, project crashed , message :message sent deallocated instance. add - (void)dealloc { [self.tableview setdelegate:nil]; }
project , crash doesn't happen again. still can't understand why project crash if didn't add code mentioned above. delegate deallocated , still sent message it? teach me this. following code in scrollview did scroll method.
- (void)scrollviewdidscroll:(uiscrollview *)scrollview{ cgfloat y = scrollview.contentoffset.y; [self.navigationcontroller.navigationbar lt_setbackgroundcolor:gwprgbcolor(255, 255, 255, ((y-100)/100.0f))]; }
Comments
Post a Comment