【发布时间】:2015-05-13 08:01:22
【问题描述】:
当我尝试分配 UISearchDisplayController
UISearchBar *searchBar = [[UISearchBar alloc] initiWithFrame: CGRectMake(0,0,310,44)];
self.searchDisplayController = [[UISearchDisplayController alloc] initWithSearchBar: searchBar contentsController:self];
它给了我一个错误:
分配给只读属性
当我以编程方式添加 tableview of UISearchController 时,我没有收到:
UITableView *resultsTableView = [[UITableView alloc] initWithFrame:self.myMapView.frame style:UITableViewStylePlain];
self.searchResultController = [[UITableViewController alloc] init];
self.searchResultController.tableView = resultsTableView;
[self.searchResultController.tableView setDelegate:self];
[self.searchResultController.tableView setDataSource:self];UISearchBar *searchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(0, 0, 310, 44)];
searchControllerMain = [[UISearchController alloc] initWithSearchResultsController:self.searchResultController];
searchControllerMain.searchBar.delegate = self;
searchControllerMain.searchResultsUpdater = self;
[searchControllerMain.searchBar sizeToFit];
searchBar.delegate = self;
【问题讨论】:
-
我还需要补充什么???
标签: ios uisearchdisplaycontroller