0
我有一个PFQueryTableViewController设置为在加载视图时检索满足一组基本约束的对象列表下面是实现查询的方法。在PFQueryTableViewController中筛选查询结果
- (PFQuery *)queryForTable {
//The base query.
self.query = [PFQuery queryWithClassName:self.parseClassName];
[self.query includeKey:@"photos"];
[self.query includeKey:@"user"];
[self.query orderByDescending:@"createdAt"];
[self.query whereKey:@"ordered" equalTo:[NSNumber numberWithBool:false]];
// [query whereKey:@"location" nearGeoPoint:self.currentLocation withinKilometers:32.2];
// If Pull To Refresh is enabled, query against the network by default.
if (self.pullToRefreshEnabled) {
self.query.cachePolicy = kPFCachePolicyNetworkOnly;
}
// If no objects are loaded in memory, we look to the cache first to fill the table
// and then subsequently do a query against the network.
if (self.objects.count == 0) {
self.query.cachePolicy = kPFCachePolicyCacheThenNetwork;
}
return self.query;
}
但是,我也想给用户过滤结果的选项。 我用来尝试和过滤的代码不起作用,因为对象列表不会改变。
[self clear];
[self.query whereKey:@"cuisine" equalTo:cuisine.text];
[self loadObjects];
这些指令嵌入UIAlertController
包含UITextField
称为cuisine
为什么没有在过滤器经历?
感谢, 亚洲时报Siddharth