nic*_*ljs 4 iphone uisearchbar uisearchdisplaycontroller ios
UITable
一个UISearchDisplayController
.UITable
是小于屏幕的宽度(它是280像素宽度居中).search bar
,UISearchDisplayController
表格一直到屏幕的左边.UISearchDisplayController
,我仍然得到相同的定位.我在这里设置框架:
- (void)searchDisplayController:(UISearchDisplayController *)controller didLoadSearchResultsTableView:(UITableView *)tableView {
tableView.backgroundColor = [UIColor colorWithRed:29.0/255.0 green:30.0/255.0 blue:32.0/255.0 alpha:1];
tableView.rowHeight = self.myTable.rowHeight;
tableView.frame = myTable.frame;
NSLog(@"search table origin: %f",tableView.frame.origin.x);
}
Run Code Online (Sandbox Code Playgroud)
甚至更奇怪的是,当我在最后记录搜索表位置时,它显示16.但是,它在视图中的位置0处.
任何帮助表示赞赏.
nic*_*ljs 20
我回答了自己的问题.需要在此委托方法中设置框架:
- (void)searchDisplayController:(UISearchDisplayController *)controller didShowSearchResultsTableView:(UITableView *)tableView {
tableView.frame = self.myTable.frame;
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
5516 次 |
最近记录: |