मेरे पास UITableViewController
है। मैं एक कस्टम headerView बनाने के लिए यह loadView
विधि इतनी तरह में tableView
है:कस्टम UITableView हेडर दृश्य स्मृति चेतावनी के बाद गायब हो जाता है
(void)loadView {
[super loadView];
UIView* containerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, width, height * 2)];
containerView.tag = 'cont';
containerView.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin;
UIButton* button = [UIButton buttonWithType:UIButtonTypeCustom];
button.frame = CGRectMake(padding, height, width, height);
... //configure UIButton and events
UIImageView* imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"image.png"] highlightedImage:[UIImage imageNamed:@"highlight.png"]];
imageView.frame = CGRectMake(0, 0, width, height);
... //configure UIImageView
[containerView addSubview:button];
[containerView addSubview:imageView];
self.tableView.tableHeaderView = containerView;
[imageView release];
[containerView release];
}
अन्य विधियों (viewDidLoad/अनलोड, आदि) में से कोई भी अतिभारित रहे हैं।
यह नियंत्रक एक टैब में होस्ट किया गया है। जब मैं किसी अन्य टैब पर स्विच करता हूं और स्मृति चेतावनी अनुकरण करता हूं, और फिर इस टैब पर वापस आ जाता है, तो मेरे UITableView
में मेरा कस्टोन हेडर गुम है। जैसा कि मैं उम्मीद करता हूं सभी पंक्तियां/खंड दिखाई दे रहे हैं। उपरोक्त loadView
कोड में एक बीपी डालने पर, मुझे लगता है कि जब मैं स्मृति चेतावनी के बाद टैब पर वापस स्विच करता हूं, तब भी इसे लागू किया जा रहा है, और फिर भी मैं वास्तव में हेडर नहीं देख सकता।
मैं यहां क्या खो रहा हूं इसके बारे में कोई विचार?
संपादित करें: यह डिवाइस और सिम्युलेटर पर होता है। डिवाइस पर, मैं पृष्ठभूमि में होने पर अलग-अलग ऐप्स के समूह को खोलकर बस एक स्मृति चेतावनी देता हूं।
मैं तुम्हें इस तरह से अपनी viewDidUnload() विधि में कोड है लगता है: self.tableView.tableHeaderView = nil; ? –
नहीं "अन्य विधियों में से कोई भी नहीं (viewDidLoad/Unload, आदि) अधिभारित हैं"। क्या मुझे इसकी ज़रूरत है? क्यूं कर? – psychotik
उलझन में। उम्मीद है कि कोई और मदद कर सकता है। –