出于某种原因,当我添加PFQueryTableViewController's
作为标题时,我的UISearchBar
表视图表现得很奇怪。添加后,表视图无法加载应用程序启动时从数据库中查询的对象。它显示 Loading
而不实际显示任何对象。然而,当我拉动刷新时,它会完美地填充对象。另一个问题是细胞分裂器(细灰线)消失。以下是相关代码:
- (id)initWithStyle:(UITableViewStyle)style
{
self = [super initWithStyle:style];
if (self) {
self.parseClassName = @"userListing";
self.textKey = @"listingName";
self.pullToRefreshEnabled = YES;
self.paginationEnabled = YES;
self.objectsPerPage = 15;
self.tableView.rowHeight = 60;
self.locationForQuery = [[PFUser currentUser] objectForKey:@"userLocation"];
//append the add button and title to the navigation bar
UIBarButtonItem* addButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd
target:self
action:@selector(addListing)];
[self.navigationItem setRightBarButtonItem:addButton];
self.navigationItem.title = @"Listings";
}
return self;
}
- (void)viewDidLoad{
self.locationSearchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 44)];
self.locationSearchBar.delegate = self;
self.tableView.tableHeaderView = locationSearchBar;
}
让我知道你还需要看到什么。
答案 0 :(得分:0)
找出问题所在。我忘了在覆盖中拨打[super viewDidLoad]
。