Iphone PFQueryTableViewController-Parse.com中的多个对象

Iphone PFQueryTableViewController-Parse.com中的多个对象,iphone,ios,parse-platform,Iphone,Ios,Parse Platform,我试图在PFQueryTableViewController中显示两个对象或“类名”。这是我到目前为止只有一个对象的代码。我似乎不能添加多个对象 -(id)initWithCoder:(NSCoder *)aDecoder { self = [super initWithCoder:aDecoder]; if (self) { // Customize the table // The className to query on

我试图在
PFQueryTableViewController
中显示两个对象或“类名”。这是我到目前为止只有一个对象的代码。我似乎不能添加多个对象

-(id)initWithCoder:(NSCoder *)aDecoder {
    self = [super initWithCoder:aDecoder];
    if (self) {
        // Customize the table

        // The className to query on
        self.className = @"Funny";
        //self.className = @"Story";

        // The key of the PFObject to display in the label of the default cell style
        self.textKey = @"title";

        // Whether the built-in pull-to-refresh is enabled
        self.pullToRefreshEnabled = YES;

        // Whether the built-in pagination is enabled
        self.paginationEnabled = YES;

        // The number of objects to show per page
        self.objectsPerPage = 100;
    }
    return self;
}

只需在视图控制器中添加更多属性即可。确保添加必要的方法(className2、textKey2等),并修改表视图的数据源方法以显示数据


也就是说,视图控制器是用
initWithCoder
启动的,这似乎很奇怪。这通常是storyboard为视图调用的方法。

我在保存文章时使用了两个对象。它工作得很好

 PFObject *quoteNew = [PFObject objectWithClassName:@"New"];
[quoteNew setObject:[[self attribution] text] forKey:@"by"];
[quoteNew setObject:[[self quoteText] text] forKey:@"quoteText"];
[quoteNew setObject:[[self attributionTitle] text] forKey:@"title"];



[quoteNew saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
    if (!error) {
        [self done:self];

    } else {
        [[[UIAlertView alloc] initWithTitle:@"Uh oh. Somthing went wrong"
                                    message:[[error userInfo] objectForKey:@"error"]
                                   delegate:nil
                          cancelButtonTitle:@"Ok"
                          otherButtonTitles: nil] show];
    }

}];


PFObject *quote = [PFObject objectWithClassName:@"Funny"];
[quote setObject:[[self attribution] text] forKey:@"by"];
[quote setObject:[[self quoteText] text] forKey:@"quoteText"];
[quote setObject:[[self attributionTitle] text] forKey:@"title"];


[quote saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
    if (!error) {
        [self done:self];

} else {
    [[[UIAlertView alloc] initWithTitle:@"Uh oh. Somthing went wrong"
                                message:[[error userInfo] objectForKey:@"error"]
                               delegate:nil
                      cancelButtonTitle:@"Ok"
                      otherButtonTitles: nil] show];
}

}];

}

我在哪里可以这样做?在框架中(PFQueryTableViewController.h)?你有更好的方法来代替initWithCoder吗?谢谢。