#import "YCViewController.h"
#import "YCmodel.h"
#import "YCTableViewCell.h"
#import "MBProgressHUD.h"
#import "MJRefresh.h"
#import "AFNetworking.h"
#import "MJExtension.h"
#import "UIImageView+WebCache.h"
#import "YanchuangViewController.h"
@interface YCViewController ()<UITableViewDataSource,UITableViewDelegate>
@property(nonatomic,strong)UITableView * tab;
//可變數(shù)組
@property(nonatomic,strong)NSMutableArray * aray;
@end
@implementation YCViewController
- (void)viewDidLoad {
??? [super viewDidLoad];
??? // Do any additional setup after loading the view.
??? self.aray=[[NSMutableArray alloc]init];
???
??? self.tab=[[UITableView alloc] initWithFrame:self.view.frame style:UITableViewStylePlain];
???
??? self.tab.delegate=self;
??? self.tab.dataSource=self;
???
??? [self.tab registerNib:[UINib nibWithNibName:@"LXTableViewCell" bundle:nil] forCellReuseIdentifier:@"cell"];
??? [self.view addSubview:self.tab];
??? [self AFNet];
???
}
-(void)AFNet{
???
??? AFHTTPSessionManager * manager?? = [AFHTTPSessionManager manager];
??? [manager GET:@"http://c.m.163.com/nc/article/list/T1348648517839/0-20.html" parameters:nil progress:^(NSProgress * _Nonnull downloadProgress) {
??? } success:^(NSURLSessionDataTask * _Nonnull task, id? _Nullable responseObject) {
??????? NSLog(@"%@",responseObject);
??????? NSArray *aray = responseObject[@"T1348648517839"];
??????? for(NSDictionary? * dic in aray){
??????????? YCmodel * model? =[[YCmodel alloc ]init];
??????????? [model setValuesForKeysWithDictionary:dic];
??????????? [self.aray addObject:model];
???????????
??????? }
??????? //??????? dispatch_async(dispatch_get_main_queue(), ^{
??????? [self.tab reloadData];
???????
??? } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
???????
??? }];
???
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
??? return self.aray.count;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
???
??? YCTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
??? [cell? loadDataFromModel:self.aray[indexPath.row]];
???
??? return cell;
???
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
???
??? YanchuangViewController * first =[ YanchuangViewController new];
??? YCmodel? * model = self.aray[indexPath.row];
??? first.urstring = model.url;
??? [self.navigationController pushViewController:first animated:YES];
???
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
??? return 150;
}
解析 + 網(wǎng)絡(luò)請求
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
- 文/潘曉璐 我一進(jìn)店門忌傻,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人搞监,你說我怎么就攤上這事水孩。” “怎么了琐驴?”我有些...
- 文/不壞的土叔 我叫張陵俘种,是天一觀的道長秤标。 經(jīng)常有香客問我,道長宙刘,這世上最難降的妖魔是什么苍姜? 我笑而不...
- 正文 為了忘掉前任,我火速辦了婚禮悬包,結(jié)果婚禮上衙猪,老公的妹妹穿的比我還像新娘。我一直安慰自己玉罐,他們只是感情好屈嗤,可當(dāng)我...
- 文/花漫 我一把揭開白布。 她就那樣靜靜地躺著吊输,像睡著了一般饶号。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發(fā)上季蚂,一...
- 文/蒼蘭香墨 我猛地睜開眼,長吁一口氣:“原來是場噩夢啊……” “哼葵腹!你這毒婦竟也來了高每?” 一聲冷哼從身側(cè)響起,我...
- 序言:老撾萬榮一對情侶失蹤践宴,失蹤者是張志新(化名)和其女友劉穎鲸匿,沒想到半個(gè)月后,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體阻肩,經(jīng)...
- 正文 獨(dú)居荒郊野嶺守林人離奇死亡带欢,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
- 正文 我和宋清朗相戀三年,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了烤惊。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片乔煞。...
- 正文 年R本政府宣布剥啤,位于F島的核電站,受9級特大地震影響不脯,放射性物質(zhì)發(fā)生泄漏府怯。R本人自食惡果不足惜,卻給世界環(huán)境...
- 文/蒙蒙 一防楷、第九天 我趴在偏房一處隱蔽的房頂上張望牺丙。 院中可真熱鬧,春花似錦复局、人聲如沸冲簿。這莊子的主人今日做“春日...
- 文/蒼蘭香墨 我抬頭看了看天上的太陽峦剔。三九已至,卻和暖如春角钩,著一層夾襖步出監(jiān)牢的瞬間吝沫,已是汗流浹背。 一陣腳步聲響...
- 正文 我出身青樓脊髓,卻偏偏與公主長得像辫愉,于是被迫代替她去往敵國和親。 傳聞我的和親對象是個(gè)殘疾皇子将硝,可洞房花燭夜當(dāng)晚...
推薦閱讀更多精彩內(nèi)容
- 一恭朗、簡介 <<UITableView(或簡單地說,表視圖)的一個(gè)實(shí)例是用于顯示和編輯分層列出的信息的一種手段 <<...
- 概述在iOS開發(fā)中UITableView可以說是使用最廣泛的控件袋哼,我們平時(shí)使用的軟件中到處都可以看到它的影子冀墨,類似...
- 前言 最近忙完項(xiàng)目比較閑,想寫一篇博客來分享一些自學(xué)iOS的心得體會涛贯,希望對迷茫的你有所幫助诽嘉。博主非科班出身,一些...
- { 24弟翘、Sqlite數(shù)據(jù)庫 1虫腋、存儲大數(shù)據(jù)量,增刪改查稀余,常見管理系統(tǒng):Oracle悦冀、MSSQLServer、DB...