查询列表,返回前20个数据:

//创建BmobQuery实例,指定对应要操作的数据表名称
BmobQuery *query = [BmobQuery queryWithClassName:className];
//按updatedAt进行降序排列
[query orderByDescending:@"updatedAt"];
//返回最多20个结果
query.limit = ;
//执行查询
[query findObjectsInBackgroundWithBlock:^(NSArray *array, NSError *error) {
//处理查询结果
for (BmobObject *obj in array) {
News *info = [[News alloc] init];
if ([obj objectForKey:@"title"]) {
info.title = [obj objectForKey:@"title"];
}
if ([obj objectForKey:@"describe"]) {
info.content = [obj objectForKey:@"describe"];
}
if ([obj objectForKey:@"phone"]) {
info.phoneNum = [obj objectForKey:@"phone"];
}
info.time = [_dateFormatter stringFromDate:obj.updatedAt];
[_infoMutableArray addObject:info];
} [_tableView reloadData];
}];

最新文章

  1. C# 调用Excel 出现服务器出现意外情况. (异常来自 HRESULT:0x80010105 (RPC_E_SERVERFAULT)
  2. [转]as3 算法实例【输出1 到最大的N 位数 题目:输入数字n,按顺序输出从1 最大的n 位10 进制数。比如输入3,则输出1、2、3 一直到最大的3 位数即999。】
  3. webform 中使用ajax
  4. 【Sort Colors】cpp
  5. json(gson) 转换html标签带来的麻烦
  6. Jquery的外部链接和编写样式
  7. excel筛选两列值是否相同,如果相同返回第三列值
  8. Jquery autocomplete 插件示例
  9. [LeetCode234]Palindrome Linked List
  10. 《.NET 编程结构》专题汇总
  11. poj 1411 Calling Extraterrestrial Intelligence Again
  12. java删除数组中的第n个数
  13. 《前端之路》之二:数据类型转换 && 隐式转换 || 显式转换
  14. Python之常见算法介绍
  15. 007_Reverse Integer
  16. c++引用和指针的彻底理解
  17. Codeforces 978E:Bus Video System
  18. cube-ui
  19. OpenGL资料
  20. <a>, <input>, <button>的区分与何时使用

热门文章

  1. json optString getString
  2. Jquery页面跳转
  3. jaxb异常 Class has two properties of the same name username
  4. WeakSelf和StrongSelf
  5. 管理Fragments(转)
  6. inline-block的特点
  7. 转:HTML与URL两种录制模式分析
  8. Chapter 1 First Sight——2
  9. 使用PowerDesigner画ER图详细教程
  10. base库