2010-04-21 60 views
0

我有以下代碼從上海華盈刪除的UITextField不讓它消失在屏幕上

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

步進通過它與調試器輸出

(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>> 
) 

然而,它仍然是可見的,它不會消失。即使我之後立即做[self setNeedsDisplay]

有沒有人遇到過這個?這是SDK中的錯誤還是我錯過了一些東西?

回答

0

事實證明,我在其他地方的代碼中的一個錯誤導致多個相同的視圖被創建在彼此的頂部,導致這種行爲。