默认情况下,在导航控制器中隐藏UITableView搜索栏 [英] Hide UITableView search bar by default when in a navigation controller
问题描述
我已经阅读过多篇帖子,但这对我来说不起作用。我正在使用最新的4.2 SDK。
I've read multiple posts on this but it's not working properly for me. I'm using the latest 4.2 SDK.
我的代码是
self.tableView.contentOffset = CGPointMake(0.0, 44.0);
这部分有效,它会将搜索栏向上移动一点,但它不会完全隐藏。我已经尝试将值44增加到更大的值,这对以前没有任何影响!我在表的视图控制器的viewDidLoad方法中调用此代码。有没有人有任何想法?
This partially works, it moves the search bar up a little bit, but it does not get hidden completely. I've tried increasing the value 44 to something greater and this had no affect what so ever! I'm calling this code in the viewDidLoad method of the table's view controller. Does anyone have any ideas?
推荐答案
self.tableView.contentOffset = CGPointMake(0.0, 44.0);
上面的代码确实有效,但是需要在UITableView完成所有的代码后运行细胞。我猜这是另一个问题。
The above code does in fact work but it needs to run after the UITableView has finished creating all of its cells. I guess thats another question though.
这篇关于默认情况下,在导航控制器中隐藏UITableView搜索栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!