Removing a subview my timer keeps running - iPhone SDK
I have a NSTimer running in a subview of a view. I want to remove the view and of course stop the timer. I seem to be able to remove开发者_运维百科 the view (it physically disappears) but the timer keeps running, I can see the trace statements still.
This is the code to remove the view...
for (UIView *subview in [self.myViews subviews]) {
NSLog(@"*****REMOVE current views!!!!!!!!!!!!");
// Only remove the subviews with tag not equal to 1
if (subview.tag != 1) {
NSLog(@"*****!!!");
[subview removeFromSuperview];
}
Did you try [timer invalidate]
right after [subview removeFromSuperview]
?
精彩评论