0

出于某种原因,当我添加 a作为标题时,我的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;
}

让我知道你还需要看什么。

4

1 回答 1

0

想通了问题。我忘了打电话给[super viewDidLoad]我的覆盖。

于 2013-09-10T01:52:18.067 回答