#pragma mark-(AppDelegate.H文件)-----------------------------------------------------------------------

#pragma mark-(.M文件)-----------------------------------------------------------------------

#import "AppDelegate.h"
#import "NavigationViewController.h"
#import "NewsListTVController.h" @interface AppDelegate () @end @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible]; NewsListTVController * newListVC = [[NewsListTVController alloc]init];
NavigationViewController * navlVC = [[NavigationViewController alloc]initWithRootViewController:newListVC];
self.window.rootViewController = navlVC;
[newListVC release];
[navlVC release]; return YES;
}

AppDelegate文件

#pragma mark (NavigationViewController .h文件)--------------------------------------------------------------------------------------------------------

#import <UIKit/UIKit.h>

@interface NavigationViewController : UINavigationController

@end

#pragma mark (.m文件)--------------------------------------------------------------------------------------------------------

#import "NavigationViewController.h"
#import "MacroHeader.h"
#import "NewsListTVController.h" @interface NavigationViewController () @end @implementation NavigationViewController - (void)viewDidLoad {
[super viewDidLoad];
[self commonsetting];//设置共有的导航栏属性
} -(void)commonsetting{
self.navigationBar.barTintColor = kmarginNavColor;
self.navigationBar.tintColor = [UIColor whiteColor];
} //内存安全处理
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
if ([self isViewLoaded] && !self.view.window) {
self.view = nil;
}
}

NavigationViewController文件

#ifndef wangyiNews_09_17_MacroHeader_h
#define wangyiNews_09_17_MacroHeader_h //共有导航栏颜色
#define kmarginNavColor [UIColor colorWithRed:171/255.0 green:41/255.0 blue:15/255.0 alpha:1.0]
#define kFont_date [UIFont systemFontOfSize:10] #define UIColorFromHexWithAlpha(hexValue,a) [UIColor colorWithRed:((float)((hexValue & 0xFF0000) >> 16))/255.0 green:((float)((hexValue & 0xFF00) >> 8))/255.0 blue:((float)(hexValue & 0xFF))/255.0 alpha:a]
#define UIColorFromHex(hexValue) UIColorFromHexWithAlpha(hexValue,1.0) #endif

MacroHeader.h   宏定义文件

#pragma mark (NewsListTVController .h文件)--------------------------------------------------------------------------------------------------------

#import <UIKit/UIKit.h>
@class Model;
@class Model_Detail; @interface NewsListTVController : UITableViewController
@property(nonatomic,retain)Model * mod;
@property(nonatomic,retain)NSMutableArray * arry;
@end #pragma mark (.m文件)-------------------------------------------------------------------------------------------------------- //
// NewsListTVController.m
// wangyiNews_09_17
//
// Created by lanounjw on 15/9/17.
// Copyright (c) 2015年 lanouhn. All rights reserved.
// #import "NewsListTVController.h"
#import "Model.h"
#import "Type01TVCell.h"
#import "Type02TVCell.h"
#import "Type03TVCell.h"
#import "DetailViewController.h"
#import "Model_Detail.h" @interface NewsListTVController ()
@property(nonatomic,retain)NSMutableArray * dataSource;//存放数据源
@end @implementation NewsListTVController - (void)loadView {
[super loadView];
} - (void)viewDidLoad {
[super viewDidLoad];
[self customisedNavBar];
[self readFromPlist];
[self.tableView registerClass:[Type01TVCell class] forCellReuseIdentifier:@"type01"];
[self.tableView registerClass:[Type02TVCell class] forCellReuseIdentifier:@"type02"];
[self.tableView registerClass:[Type03TVCell class] forCellReuseIdentifier:@"type03"];
} //布局私有的导航栏
-(void)customisedNavBar{
self.navigationItem.title = @"网易新闻";
UIBarButtonItem * left = [[UIBarButtonItem alloc]initWithTitle:@"注册" style:UIBarButtonItemStylePlain target:self action:@selector(handleRegister:)];
left.tintColor = [UIColor whiteColor];
self.navigationItem.leftBarButtonItem = left; UIBarButtonItem * right = [[UIBarButtonItem alloc]initWithTitle:@"登陆" style:UIBarButtonItemStylePlain target:self action:@selector(handleLogin:)];
right.tintColor = [UIColor whiteColor];
self.navigationItem.rightBarButtonItem = right;
} //首页注册按钮点击事件
-(void)handleRegister:(UIBarButtonItem *)sender{
NSLog(@"点击注册按钮");
} //首页登陆按钮点击事件
-(void)handleLogin:(UIBarButtonItem *)sender{
NSLog(@"点击登陆按钮");
} //读取本地数据源
-(void)readFromPlist{
self.dataSource = [NSMutableArray arrayWithCapacity:];
NSString * filePath = [[NSBundle mainBundle] pathForResource:@"NewsData" ofType:@"plist"];
NSDictionary * data = [NSDictionary dictionaryWithContentsOfFile:filePath];
for (NSString * key in data) {
if ([key isEqualToString:@"news"]) {
NSArray *newsArr = [NSArray arrayWithArray:[data objectForKey:key]];
for (NSDictionary * dic in newsArr) {
Model * model = [[Model alloc]initWithDic:dic];
[_dataSource addObject:model];
[model release];
}
}
}
} //内存警告处理
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
if ([self isViewLoaded] && !self.view.window) {
self.view = nil;
}
} #pragma mark - Table view data source - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return ;
} - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return self.dataSource.count;
} - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
Model * model = self.dataSource[indexPath.row];
int num = indexPath.row % ;
if (num == ) {
Type01TVCell *cell = [tableView dequeueReusableCellWithIdentifier:@"type01" forIndexPath:indexPath];
cell.model = model;
return cell;
}
if (num == ) {
Type02TVCell *cell = [tableView dequeueReusableCellWithIdentifier:@"type02" forIndexPath:indexPath];
cell.model = model;
return cell;
}
if (num == ) {
Type03TVCell *cell = [tableView dequeueReusableCellWithIdentifier:@"type03" forIndexPath:indexPath];
cell.model = model;
return cell;
}
return nil;
} -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
int num = indexPath.row % ;
if (num == ) {
return ;
}
return ;
} //选中某一行新闻进入新闻详情
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
self.mod = self.dataSource[indexPath.row];
Model_Detail * moArr = [[Model_Detail alloc]init];
moArr.title = _mod.title;
moArr.summary = _mod.summary;
moArr.date = _mod.PUBLISHDATE;
moArr.imageView = _mod.imageview;
DetailViewController * detailVC = [[DetailViewController alloc]init];
self.arry = [NSMutableArray arrayWithArray: [moArr getArray]];//成功得到数据
[self.navigationController pushViewController:detailVC animated:YES];
[detailVC release];
} -(void)viewWillDisappear:(BOOL)animated{
DetailViewController * detailVC = [[DetailViewController alloc]init];
detailVC.arr = self.arry;
NSLog(@"%@",_arry);
NSLog(@"页面将要消失%@",detailVC.arr);
} /*
// Override to support conditional editing of the table view.
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
// Return NO if you do not want the specified item to be editable.
return YES;
}
*/ /*
// Override to support editing the table view.
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
if (editingStyle == UITableViewCellEditingStyleDelete) {
// Delete the row from the data source
[tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
} else if (editingStyle == UITableViewCellEditingStyleInsert) {
// Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
}
}
*/ /*
// Override to support rearranging the table view.
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath {
}
*/ /*
// Override to support conditional rearranging of the table view.
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
// Return NO if you do not want the item to be re-orderable.
return YES;
}
*/ /*
#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

NewsListTVController 文件

#pragma mark (Type01TVCell .h文件)--------------------------------------------------------------------------------------------------------

#import <UIKit/UIKit.h>
@class Model; @interface Type01TVCell : UITableViewCell
@property(nonatomic,retain)Model * model;
@property(nonatomic,retain)UILabel * titleLabel;
@property(nonatomic,retain)UILabel * summaryLabel;
@property(nonatomic,retain)UILabel * dateLabel;
@property(nonatomic,retain)UIImageView * viewImage; @end #pragma mark (.m文件)-------------------------------------------------------------------------------------------------------- //
// Type01TVCell.m
// wangyiNews_09_17
//
// Created by lanounjw on 15/9/17.
// Copyright (c) 2015年 lanouhn. All rights reserved.
// #import "Type01TVCell.h"
#import "Model.h"
#import "MacroHeader.h" @implementation Type01TVCell -(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
[self.contentView addSubview:self.titleLabel];
[self.contentView addSubview:self.summaryLabel];
[self.contentView addSubview:self.dateLabel];
self.viewImage =[[UIImageView alloc]initWithFrame:CGRectMake(, , , )];
_viewImage.tag = ;
//新闻图片是随机出现的
[_viewImage setImage:[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:[NSString stringWithFormat:@"new%d",(arc4random()%)+] ofType:@"png"]]];
// NSLog(@"%d",(arc4random()%7)+1);
[self.contentView addSubview:_viewImage];
}
return self;
} -(UILabel *)titleLabel{
if (!_titleLabel) {
self.titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(, , , )];
_titleLabel.backgroundColor = UIColorFromHex(0xEEEEE0);
}
return [[_titleLabel retain]autorelease];
}
-(UILabel *)summaryLabel{
if (!_summaryLabel) {
self.summaryLabel = [[UILabel alloc]initWithFrame:CGRectMake(, , , )];
self.summaryLabel.adjustsFontSizeToFitWidth = YES;
self.summaryLabel.numberOfLines = ;
self.summaryLabel.font = [UIFont systemFontOfSize:];
}
return [[_summaryLabel retain]autorelease];
}
-(UILabel *)dateLabel{
if (!_dateLabel) {
self.dateLabel = [[UILabel alloc]initWithFrame:CGRectMake(, , , )];
_dateLabel.font = [UIFont systemFontOfSize:];
}
return [[_dateLabel retain]autorelease];
} -(void)setModel:(Model *)model{
if (self.model != model) {
[_model release];
_model = [_model retain];
}
self.titleLabel.text = model.title;
self.summaryLabel.text = [[model.summary substringToIndex:]stringByAppendingString:@"..."];
self.dateLabel.text = model.PUBLISHDATE;
model.imageview = self.imageView;
self.viewImage = model.imageview;
}
@end

Type01TVCell 文件

#pragma mark (Type02TVCell .h文件)--------------------------------------------------------------------------------------------------------

#import <UIKit/UIKit.h>
@class Model; @interface Type02TVCell : UITableViewCell
@property(nonatomic,retain)Model * model;
@property(nonatomic,retain)UILabel * titleLabel;
@property(nonatomic,retain)UILabel * summaryLabel;
@property(nonatomic,retain)UILabel * dateLabel;
@property(nonatomic,retain)UIImageView * viewImage;
@end #pragma mark (.m文件)-------------------------------------------------------------------------------------------------------- //
// Type02TVCell.m
// wangyiNews_09_17
//
// Created by lanounjw on 15/9/17.
// Copyright (c) 2015年 lanouhn. All rights reserved.
// #import "Type02TVCell.h"
#import "Model.h"
#import "MacroHeader.h" @implementation Type02TVCell -(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
[self.contentView addSubview:self.titleLabel];
[self.contentView addSubview:self.summaryLabel];
[self.contentView addSubview:self.dateLabel];
self.viewImage =[[UIImageView alloc]initWithFrame:CGRectMake(, , , )];
//新闻图片是随机出现的
[_viewImage setImage:[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:[NSString stringWithFormat:@"new%d",(arc4random()%)+] ofType:@"png"]]];
[self.contentView addSubview:_viewImage];
}
return self;
} -(UILabel *)titleLabel{
if (!_titleLabel) {
self.titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(, , , )];
_titleLabel.backgroundColor = UIColorFromHex(0xEEEEE0);
}
return [[_titleLabel retain]autorelease];
}
-(UILabel *)summaryLabel{
if (!_summaryLabel) {
self.summaryLabel = [[UILabel alloc]initWithFrame:CGRectMake(, , , )];
self.summaryLabel.adjustsFontSizeToFitWidth = YES;
self.summaryLabel.numberOfLines = ;
self.summaryLabel.font = [UIFont systemFontOfSize:]; }
return [[_summaryLabel retain]autorelease];
}
-(UILabel *)dateLabel{
if (!_dateLabel) {
self.dateLabel = [[UILabel alloc]initWithFrame:CGRectMake(, , , )];
_dateLabel.font = kFont_date;
}
return [[_dateLabel retain]autorelease];
} -(void)setModel:(Model *)model{
if (self.model != model) {
[_model release];
_model = [_model retain];
}
self.titleLabel.text = model.title;
self.summaryLabel.text = [[model.summary substringToIndex:]stringByAppendingString:@"..."];
self.dateLabel.text = model.PUBLISHDATE;
model.imageview = self.imageView;
self.viewImage = model.imageview;
}
@end

Type02TVCell 文件

#pragma mark (Type03TVCell .h文件)--------------------------------------------------------------------------------------------------------

#import <UIKit/UIKit.h>
@class Model; @interface Type03TVCell : UITableViewCell
@property(nonatomic,retain)Model * model;
@property(nonatomic,retain)UILabel * titleLabel;
@property(nonatomic,retain)UILabel * summaryLabel;
@property(nonatomic,retain)UILabel * dateLabel;
@property(nonatomic,retain)UIImageView * viewImage;
@end #pragma mark (.m文件)-------------------------------------------------------------------------------------------------------- //
// Type03TVCell.m
// wangyiNews_09_17
//
// Created by lanounjw on 15/9/17.
// Copyright (c) 2015年 lanouhn. All rights reserved.
// #import "Type03TVCell.h"
#import "Model.h"
#import "MacroHeader.h" @implementation Type03TVCell -(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
[self.contentView addSubview:self.titleLabel];
[self.contentView addSubview:self.summaryLabel];
self.summaryLabel.adjustsFontSizeToFitWidth = YES;
self.summaryLabel.numberOfLines = ;
self.summaryLabel.font = [UIFont systemFontOfSize:];
[self.contentView addSubview:self.dateLabel];
self.viewImage =[[UIImageView alloc]initWithFrame:CGRectMake(, , , )];
//新闻图片是随机出现的
[_viewImage setImage:[[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:[NSString stringWithFormat:@"girl%d",(arc4random()%)+] ofType:@"png"]] imageWithRenderingMode:UIImageRenderingModeAutomatic]];
[self.contentView addSubview:_viewImage];
}
return self;
}
//#EAEAEA
-(UILabel *)titleLabel{
if (!_titleLabel) {
self.titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(, , , )];
_titleLabel.backgroundColor = UIColorFromHex(0xEEEEE0);
}
return [[_titleLabel retain]autorelease];
}
-(UILabel *)summaryLabel{
if (!_summaryLabel) {
self.summaryLabel = [[UILabel alloc]initWithFrame:CGRectMake(, , , )];
}
return [[_summaryLabel retain]autorelease];
}
-(UILabel *)dateLabel{
if (!_dateLabel) {
self.dateLabel = [[UILabel alloc]initWithFrame:CGRectMake(, , , )];
_dateLabel.font = kFont_date;
}
return [[_dateLabel retain]autorelease];
} -(void)setModel:(Model *)model{
if (self.model != model) {
[_model release];
_model = [_model retain];
}
self.titleLabel.text = model.title;
self.summaryLabel.text = [[model.summary substringToIndex:]stringByAppendingString:@"..."];
self.dateLabel.text = model.PUBLISHDATE;
model.imageview = self.imageView;
self.viewImage = model.imageview;
}
@end

Type03TVCell 文件

#pragma mark (.h文件)--------------------------------------------------------------------------------------------------------

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h> //封装类 把本地 plist 文件里小字典里的信息存放到一个一个的对象里
@interface Model : NSObject
@property(nonatomic,retain)NSString * title;
@property(nonatomic,retain)NSString * summary;
@property(nonatomic,retain)NSString * PUBLISHDATE;
@property(nonatomic,retain)UIImageView * imageview;
-(instancetype)initWithDic:(NSDictionary * )dic;
@end #pragma mark (.m文件)-------------------------------------------------------------------------------------------------------- //
// Model.m
// wangyiNews_09_17
//
// Created by lanounjw on 15/9/17.
// Copyright (c) 2015年 lanouhn. All rights reserved.
// #import "Model.h" @implementation Model //封装类 把找到的 key (这里的属性)赋值给封装类的属性(本类的属性)
-(instancetype)initWithDic:(NSDictionary * )dic{
self = [super init];
if (self) {
[self setValuesForKeysWithDictionary:dic];
}
return self;
} -(void)setValue:(id)value forUndefinedKey:(NSString *)key{ } -(void)dealloc{
self.title = nil;
self.summary = nil;
self.PUBLISHDATE = nil;
[super dealloc];
}
@end

Model 文件

#pragma mark (.h文件)--------------------------------------------------------------------------------------------------------

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h> typedef NSMutableArray * (^titleAndSummaryAndDate)(NSMutableArray * modelArr);
@interface Model_Detail : NSObject
@property(nonatomic,copy)titleAndSummaryAndDate modelArrary;
@property(nonatomic,retain)NSString * title, * summary, * date;
@property(nonatomic,retain)UIImageView * imageView;
@property(nonatomic,retain)NSMutableArray * allArrary;
-(NSMutableArray *)getArray; @end #pragma mark (.m文件)-------------------------------------------------------------------------------------------------------- // Model_Detail.m
// wangyiNews_09_17
//
// Created by lanounjw on 15/9/17.
// Copyright (c) 2015年 lanouhn. All rights reserved.
// #import "Model_Detail.h" @implementation Model_Detail -(void)setTitle:(NSString *)title{
if (_title != title) {
[_title release];
_title = [title retain];
}
}
-(void)setSummary:(NSString *)summary{
if (_summary != summary) {
[_summary release];
_summary = [summary retain];
}
}
-(void)setDate:(NSString *)date{
if (_date != date) {
[_date release];
_date = [date retain];
}
}
-(void)setImageView:(UIImageView *)imageView{
if (_imageView != imageView) {
[_imageView release];
_imageView = [imageView retain];
}
}
-(void)setModelArrary:(titleAndSummaryAndDate)modelArrary{
if (_modelArrary != modelArrary) {
[_modelArrary release];
_modelArrary = [modelArrary retain];
}
}
-(NSMutableArray *)getArray{
NSMutableArray * arr0 = [NSMutableArray arrayWithCapacity:];
[arr0 addObject:self.title];
NSMutableArray * arr1 = [NSMutableArray arrayWithCapacity:];
[arr1 addObject:self.summary];
NSMutableArray * arr2 = [NSMutableArray arrayWithCapacity:];
[arr2 addObject:self.date];
NSMutableArray * arr3 = [NSMutableArray arrayWithCapacity:];
[arr3 addObject:self.imageView];
self.allArrary = [NSMutableArray arrayWithCapacity:];
[_allArrary addObject:arr0];
[_allArrary addObject:arr1];
[_allArrary addObject:arr2];
[_allArrary addObject:arr3];
NSLog(@"model_Detal 测试 %@",_allArrary);
return _allArrary;
} @end

Model_Detail文件

#pragma mark (DetailViewController .h文件)--------------------------------------------------------------------------------------------------------

#import <UIKit/UIKit.h>
#import "Model.h" @interface DetailViewController : UIViewController @property(nonatomic,retain)UILabel * titleLabel;
@property(nonatomic,retain)UILabel * summaryLabel;
@property(nonatomic,retain)UILabel * dateLabel;
@property(nonatomic,retain)UIImageView * imageView;
@property(nonatomic,retain)NSMutableArray * arr;
@property(nonatomic,retain)NSString * str0,*str1,*str2,*str3;
@end #pragma mark (.m文件)-------------------------------------------------------------------------------------------------------- //
// DetailViewController.m
// wangyiNews_09_17
//
// Created by lanounjw on 15/9/17.
// Copyright (c) 2015年 lanouhn. All rights reserved.
// #import "DetailViewController.h"
#import "NewsListTVController.h" @interface DetailViewController () @end @implementation DetailViewController -(void)viewWillAppear:(BOOL)animated{
// self.str0 = _arr[0];
// self.str1 = _arr[1];
// self.str2 = _arr[2];
// self.str3 = _arr[3];
NSLog(@"页面将要出现%@ ",_arr);
}
- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = [UIColor whiteColor];
[self customsizedNavBar];
[self makeDetialView];
} //私有导航条的设置
-(void)customsizedNavBar{
self.navigationItem.title = @"新闻详情";
UIBarButtonItem * left = [[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"btn_navigationBar_back@2x"] style:UIBarButtonItemStylePlain target:self action:@selector(handleBack:)];
self.navigationItem.leftBarButtonItem = left;
[left release]; UIBarButtonItem * right = [[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"doneR@2x"] style:UIBarButtonItemStylePlain target:self action:@selector(handleAddDone:)];
self.navigationItem.rightBarButtonItem = right;
[right release];
} //加载详情信息页面
-(void)makeDetialView{
//接受信息
// self.imageView = [[UIImageView alloc]initWithFrame:CGRectMake(10, 74,self.view.frame.size.width - 20, self.view.frame.size.height * 0.2)];
// _imageView = _arr[3];
// [self.view addSubview:self.imageView];
// _imageView.backgroundColor = [UIColor redColor];
// [_imageView release]; self.titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(, self.view.frame.size.height * 0.2 + , self.view.frame.size.width - ,)];
_titleLabel.text = self.str0;
_titleLabel.backgroundColor = [UIColor grayColor];
[self.view addSubview:_titleLabel];
[_titleLabel release]; //自适应高度
CGFloat height = ;
self.summaryLabel = [[UILabel alloc]initWithFrame:CGRectMake(, self.view.frame.size.height * 0.65 - , self.view.frame.size.width - , height)];
[self.view addSubview:_summaryLabel];
_summaryLabel.text = _arr[];
_summaryLabel.backgroundColor = [UIColor greenColor];
[_summaryLabel release]; self.dateLabel = [[UILabel alloc]initWithFrame:CGRectMake(self.view.frame.size.width - ,self.view.frame.size.height - , , )];
_dateLabel.text = _arr[];
[self.view addSubview:_dateLabel];
_dateLabel.backgroundColor = [UIColor blueColor];
} //返回按钮点击事件
-(void)handleBack:(UIBarButtonItem *)sender{
[self.navigationController popViewControllerAnimated:YES];
}
//收藏按钮点击事件
-(void)handleAddDone:(UIBarButtonItem *)sender{
NSLog(@"触发收藏按钮点击事件");
} //内存警告处理
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
if ([self isViewLoaded] && !self.view.window) {
self.view = nil;
}
} @end

DetailViewController 文件

UI: 网易新闻实现的更多相关文章

  1. iOS仿网易新闻栏目拖动重排添加删除效果

    仿网易新闻栏目选择页面的基本效果,今天抽了点时间教大家如何实现UICollectionView拖动的效果! 其实实现起来并不复杂,这里只是基本的功能,没有实现细节上的修改,连UI都是丑丑的样子,随手画 ...

  2. Android(java)学习笔记206:利用开源SmartImageView优化网易新闻RSS客户端

    1.我们自己编写的SmartImageView会有很多漏洞,但是我们幸运的可以在网上利用开源项目的,开源项目中有很多成熟的代码,比如SmartImageView都编写的很成熟的 国内我们经常用到htt ...

  3. Android(java)学习笔记205:网易新闻RSS客户端应用编写逻辑过程

    1.我们的项目需求是编写一个新闻RSS浏览器,RSS(Really Simple Syndication)是一种描述和同步网站内容的格式,是使用最广泛的XML应用.RSS目前广泛用于网上新闻频道,bl ...

  4. 【转】 iOS开发 剖析网易新闻标签栏视图切换(addChildViewController属性介绍)

    原文:http://blog.csdn.net/hmt20130412/article/details/34523235 本来只是打算介绍一下addChildViewController这个方法的,正 ...

  5. Android应用经典主界面框架之二:仿网易新闻client、CSDN client (Fragment ViewPager)

    另外一种主界面风格则是以网易新闻.凤凰新闻以及新推出的新浪博客(阅读版)为代表.使用ViewPager+Fragment,即ViewPager里适配器里放的不是一般的View.而是Fragment.所 ...

  6. iOS开发 剖析网易新闻标签栏视图切换(addChildViewController属性介绍)

    本文转载至 http://www.tuicool.com/articles/3ymMzub CSDN博客原文  http://blog.csdn.net/hmt20130412/article/det ...

  7. Android(java)学习笔记149:利用开源SmartImageView优化网易新闻RSS客户端

    1.我们自己编写的SmartImageView会有很多漏洞,但是我们幸运的可以在网上利用开源项目的,开源项目中有很多成熟的代码,比如SmartImageView都编写的很成熟的 国内我们经常用到htt ...

  8. Android(java)学习笔记148:网易新闻RSS客户端应用编写逻辑过程

    1.我们的项目需求是编写一个新闻RSS浏览器,RSS(Really Simple Syndication)是一种描述和同步网站内容的格式,是使用最广泛的XML应用.RSS目前广泛用于网上新闻频道,bl ...

  9. 网易新闻App架构重构实践:DDD正走向流行

    网易新闻App架构重构实践:DDD正走向流行 https://mp.weixin.qq.com/s/FdwrT_xn3CQqpWoRVBttvQ 小智 InfoQ 2020-05-14 作者 | 小智 ...

随机推荐

  1. Prime Ring Problem---hdu1016(dfs)

    http://acm.hdu.edu.cn/showproblem.php?pid=1016 这就是一道简单的dfs  但是是我自己想起来的   必须要记录一下 #include<stdio.h ...

  2. Java的vector可实现自动增长的数组

    Vector维克多提供了向量类(vector)以实现类似动态数组的功能. 首先,在Java中并没有指针这样的概念 ,但如果正确灵活地使用指针又确实可以大大提高程序的质量.比如在c,c++中所谓的“动态 ...

  3. 使用mysql-connector-java.jar连接MySql时出现:Error while retrieving metadata for procedure columns: java.sql.SQLException: Parameter/Column name pattern can not be NULL or empty.

    错误如下: 程序实现的功能是调用一个存储过程,但是不认这个存储过程的参数. 原因是版本太高了,由于使用的是6.0.6版本的,改成5.1.38即可. POM配置如下: <!-- mysql-con ...

  4. 报错: The type ByteInputStream is not accessible due to restriction on required library

    报错: Access restriction:The type JPEGCodec is not accessible due to restriction on required library C ...

  5. how to read openstack code: Core plugin and resource extension

    本章我们将写一个自己的core plugin 和一个resource extension来加深理解.(阅读本文的前提是你已经理解了restful以及stevedore等内容) 什么是 core plu ...

  6. Hexo搭建个人blog

    Hexo搭建 现在只想说心累... 前几天看了几个牛人的blog,感觉他们的风格很舒服,然后就发现了Hexo这个好东西!激动的想马上自己也弄一个,昨天晚上开始看资料特别是:潘柏信写了两篇 HEXO搭建 ...

  7. 纠结的链接——ln、ln -s、fs.symlink、require

    纠结的链接--ln.ln -s.fs.symlink.require 提交 我的留言 加载中 已留言 inode 我们首先来看看 linux 系统里面的一个重要概念:inode. 我们知道,文件存储在 ...

  8. nagios 安装配置(包含nrpe端)全 (三)

    四.系统的配置: 1.介绍 在配置过程中涉及到的几个定义有:主机.主机组,服务.服务组.联系人.联系人组,监控时间.监控命令等. 最重要的有四点: 第一:定义监控哪些主机.主机组.服务和服务组: 第二 ...

  9. Android常见UI组件之ListView(二)——定制ListView

    Android常见UI组件之ListView(二)--定制ListView 这一篇接上篇.展示ListView中选择多个项及实现筛选功能~ 1.在位于res/values目录下的strings.xml ...

  10. strtok函数

    strtok函数是cstring文件里的函数 strtok函数是cstring文件里的函数 其功能是截断字符串 原型为:char *strtok(char s[],const char *delin) ...