Removing UITextField from superview does not make it disappear on screen

Posted by moshy on Stack Overflow See other posts from Stack Overflow or by moshy
Published on 2010-04-21T12:33:22Z Indexed on 2010/04/25 3:43 UTC
Read the original article Hit count: 284

I have the following code

// Breakpoint here
[label removeFromSuperview];
[label release];
label = nil;

stepping through it with the debugger outputs

(gdb) po [self subviews]
<NSCFArray 0x476af70>(
<UIImageView: 0x47581a0; frame = (0 0; 232 81); opaque = NO; autoresize = W+H; userInteractionEnabled = NO; layer = <CALayer: 0x476b3d0>>,
<UILabel: 0x4758870; frame = (15 11; 202 56); text = 'Test'; clipsToBounds = YES; autoresize = W+H; userInteractionEnabled = NO; layer = <CALayer: 0x476b590>>
)

(gdb) po label
<UILabel: 0x4758870; frame = (15 11; 202 56); text = 'Test'; clipsToBounds = YES; autoresize = W+H; userInteractionEnabled = NO; layer = <CALayer: 0x476b590>>
(gdb) n
(gdb) n
(gdb) n
(gdb) po [self subviews]
<NSCFArray 0x478c4e0>(
<UIImageView: 0x47581a0; frame = (0 0; 232 81); opaque = NO; autoresize = W+H; userInteractionEnabled = NO; layer = <CALayer: 0x476b3d0>>
)

Yet it is still visible, it does not disappear. Not even if I do [self setNeedsDisplay] immediately after.

Has anyone else come across this? Is it a bug in the SDK or am I missing something?

© Stack Overflow or respective owner

Related posts about iphone

Related posts about subview