在我的项目中,用户提交了一个故事,我试图将这个故事放在“热门页面”上,但还没有找到方法。到目前为止,这是我的代码,提前致谢,是的,我知道它不多,但有任何帮助。
MasterViewContoller.m
-(id)initWithCoder:(NSCoder *)aDecoder {
self = [super initWithCoder:aDecoder];
if (self) {
// Customize the table
// The className to query on
self.className = @"Word";
// The key of the PFObject to display in the label of the default cell style
self.textKey = @"by";
// Uncomment the following line to specify the key of a PFFile on the PFObject to display in the imageView of the default cell style
// self.imageKey = @"image";
// 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 = 25;
}
return self;
}
云代码
Parse.Cloud.beforeSave("Word", function(request, response) {
var wordText = request.Object.get("wordText");
var attribution = request.Object.get("by");
if(wordText.length){
if (attribution.length){
response.success();
}else{
request.object.set("by", "annoymous");
response.success();
}
}else{
response.error("Not valid. Please fill in all text");
}
});