首页 > 其他 > 详细

获取微博数据2主页加载

时间:2015-10-02 17:14:37      阅读:204      评论:0      收藏:0      [点我收藏+]

继承 RootViewController.h


#import
<UIKit/UIKit.h> #import "AFNetworking.h" #import "IWAccount.h" #import "IWAccountTool.h" #import "MJExtension.h" @interface RootViewController : UIViewController @end
#import "RootViewController.h"

@interface RootViewController ()

@end

@implementation RootViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end

 

主页继承封装

#import "RootViewController.h"

@interface HomeViewController : RootViewController

@end
技术分享
#import "HomeViewController.h"
#import "MBProgressHUD+MJ.h"

@interface HomeViewController ()

@end

@implementation HomeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.view.backgroundColor = [UIColor orangeColor];
    
    
    //网络请求
    //2.00L6_1_D3zyz2E450dccc178VbKkdD
    //https://api.weibo.com/2/statuses/home_timeline.json?access_token=2.00L6_1_D3zyz2E450dccc178VbKkdD
    
    // 1.创建请求管理对象
    AFHTTPRequestOperationManager *mgr = [AFHTTPRequestOperationManager manager];
    
    // 2.封装请求参数
    NSMutableDictionary *params = [NSMutableDictionary dictionary];
    params[@"access_token"] = [IWAccountTool account].access_token;
    
    // 3.发送请求
    [mgr GET:@"https://api.weibo.com/2/statuses/home_timeline.json" parameters:params
     success:^(AFHTTPRequestOperation *operation, id responseObject) {
         // 将字典数组转为模型数组(里面放的就是IWStatus模型)
         //self.statuses = [IWStatus objectArrayWithKeyValuesArray:responseObject[@"statuses"]];
         
         // 刷新表格

     } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
         
     }];


    
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
View Code

 

获取微博数据2主页加载

原文:http://www.cnblogs.com/coderMJL/p/4852352.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!