User talk:Wangyue

APContentsView Class Reference

Overview
APContentsView 定义了目录页模版统一的数据源和行为接口.

Task
通过initWithFrame方法进行初始化

Properties
dataSource

@property(nonatomic, assign) id dataSource;

用于获取数据的数据源的代理，APContentsViewDataSource定义了datasource方法. 参考APContentsViewDataSource

contentsViewDelegate @property(nonatomic, assign) id contentsViewDelegate;

contentsViewDelegate保存了APContensView的delegate

参考APContentsViewDelegate

Class Methods
暂无

- reloadData
从数据源加载数据 (void)reloadData;

Parameters
 * 无

- orientationChangedTo
改变View的显示位置（水平、竖直） - (void) orientationChangedTo:(UIInterfaceOrientation)orientation; Parameters
 * orientation UIInterfaceOrientation
 * View置位置, 包括
 * UIInterfaceOrientationPortrait
 * UIInterfaceOrientationPortraitUpsideDown
 * UIInterfaceOrientationLandscapeLeft
 * UIInterfaceOrientationLandscapeRight

- setSelectedDoc
设置被选中的文章 - (void)setSelectedDoc:(NSIndexPath*)index; Parameters
 * index NSIndexPath
 * 文章所在的Column的索引(section)，和文章在该Column内的索引(row)

- readArticle
- (void)readArticle:(int)doc_index atColumn:(int)column_index; 处理读取文章

Parameters
 * column_index int
 * 文章所在的Column的索引
 * doc_index int
 * 文章在该Column内的索引

- APContentsViewDataSource
@protocol APContentsViewDataSource

Required

- contentsView:docDict
返回文章内容的字典（字典的键值参见XmlDecoder.h) - (NSDictionary*) contentsView:(APContentsView *)contentsView docDict:(NSIndexPath*)index; Parameters
 * contentsView APContentsView
 * index NSIndexPath 文章所在的column的索引和该文章在该column内的索引

- contentsView:columnDict
返回文章栏目的字典（字典的键值参见XmlDecoder.h) - (NSDictionary*) contentsView:(APContentsView *)contentsView columnDict:(NSInteger)index;

Parameters
 * contentsView APContentsView
 * index NSInteger column的索引

- numberOfColumnsForCurrentIssue
返回当前issue里面的专栏数 - (int) numberOfColumnsForCurrentIssue:(APContentsView *)contentsView; Parameters contentsView APContentsView

- contentsView:numberOfDocsForColumn
指定column中的文章数目 - (int) contentsView:(APContentsView *)contentsView numberOfDocsForColumn:(NSInteger) column_index;

Parameters
 * column_index NSInteger
 * 栏目所在的索引

- contentsView:visibleDocsForColumn
指定column栏目中显示的文章 - (NSArray *) contentsView:(APContentsView *)contentsView visibleDocsForColumn:(NSInteger) column_index;

Parameters
 * column_index NSInteger
 * 栏目所在的索引

optional

- featuredArticles
返回特色文章的数组 - (NSMutableArray *) featuredArticles:(APContentsView *)contentsView;

Parameters
 * contentsView APContentsView

- pathForCategoryImage:atSelectedColume
返回Category图片的所在路径 - (NSString *) pathForCategoryImage:(APContentsView *)contentsView atSelectedColume:(NSInteger)selectedColume;

Parameters
 * contentsView APContentsView
 * selectedColume NSInteger

- pathForIssueCoverImage
返回issue封面图片的所在路径 - (NSString *) pathForIssueCoverImage:(APContentsView *)contentsView;

Parameters
 * contentsView APContentsView

- issueDirectory
返回当前issue数据所在的路径 - (NSString*) issueDirectory:(APContentsView *)contentsView; Parameters
 * contentsView APContentsView

Delegate
required

暂无

optional

- contentsView:didSelectAtDoc
处理选择一篇文章 - (void)contentsView:(APContentsView *)contentsView didSelectAtDoc:(NSIndexPath*)index; Parameters
 * contentsView APContentsView
 * index NSIndexPath 文章所在位置，包括文章所在栏目的索引(section)和文章在该栏目中的索引(row)