Skip to content

Commit

Permalink
edit
Browse files Browse the repository at this point in the history
  • Loading branch information
anyunzhong committed Feb 15, 2016
1 parent bee36de commit 430f428
Showing 1 changed file with 86 additions and 1 deletion.
87 changes: 86 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ DFTimelineView

仿微信朋友圈 支持图文和短视频

[![Alt][screenshot1_thumb]][screenshot1]    [![Alt][screenshot2_thumb]][screenshot2]    [![Alt][screenshot3_thumb]][screenshot3]    [![Alt][screenshot4_thumb]][screenshot4]    [![Alt][screenshot5_thumb]][screenshot5]    [![Alt][screenshot6_thumb]][screenshot6]    [![Alt][screenshot7_thumb]][screenshot7]    [![Alt][screenshot8_thumb]][screenshot8]    [![Alt][screenshot8_thumb]][screenshot8]
[![Alt][screenshot1_thumb]][screenshot1]    [![Alt][screenshot2_thumb]][screenshot2]    [![Alt][screenshot3_thumb]][screenshot3]    [![Alt][screenshot4_thumb]][screenshot4]    [![Alt][screenshot5_thumb]][screenshot5]    [![Alt][screenshot6_thumb]][screenshot6]    [![Alt][screenshot7_thumb]][screenshot7]    [![Alt][screenshot8_thumb]][screenshot8]    [![Alt][screenshot9_thumb]][screenshot9]

[screenshot1_thumb]: http://file-cdn.datafans.net/github/dftimelineview/1.jpg_250.jpeg
[screenshot1]: http://file-cdn.datafans.net/github/dftimelineview/1.jpg
Expand All @@ -27,3 +27,88 @@ DFTimelineView
[screenshot9_thumb]: http://file-cdn.datafans.net/github/dftimelineview/9.jpg_250.jpeg
[screenshot9]: http://file-cdn.datafans.net/github/dftimelineview/9.jpg


Installation
============

```ruby
pod 'DFTimelineView'
```

Usage
===============

```obj-c
#import "DFTimelineView.h"
```

###### 主时间轴 直接继承 DFTimeLineViewController

###### 添加图文
```obj-c
DFTextImageLineItem *textImageItem = [[DFTextImageLineItem alloc] init];
textImageItem.itemId = 10000000; //随便设置一个 待服务器生成
textImageItem.userId = 10018;
textImageItem.userAvatar = @"http://file-cdn.datafans.net/avatar/1.jpeg";
textImageItem.userNick = @"富二代";
textImageItem.title = @"发表了";
textImageItem.text = text;


NSMutableArray *srcImages = [NSMutableArray array];
textImageItem.srcImages = srcImages; //大图 可以是本地路径 也可以是网络地址 会自动判断

NSMutableArray *thumbImages = [NSMutableArray array];
textImageItem.thumbImages = thumbImages; //小图 可以是本地路径 也可以是网络地址 会自动判断


for (id img in images) {
[srcImages addObject:img];
[thumbImages addObject:img];
}

textImageItem.location = @"广州信息港";
[self addItemTop:textImageItem];

```
###### 添加小视频
```obj-c
DFVideoLineItem *videoItem = [[DFVideoLineItem alloc] init];
videoItem.itemId = 10000000; //随便设置一个 待服务器生成
videoItem.userId = 10018;
videoItem.userAvatar = @"http://file-cdn.datafans.net/avatar/1.jpeg";
videoItem.userNick = @"富二代";
videoItem.title = @"发表了";
videoItem.text = @"新年过节 哈哈"; //这里需要present一个界面 用户填入文字后再发送 场景和发图片一样
videoItem.location = @"广州";
videoItem.localVideoPath = videoPath;
videoItem.videoUrl = @""; //网络路径
videoItem.thumbUrl = @"";
videoItem.thumbImage = screenShot; //如果thumbImage存在 优先使用thumbImage
[self addItemTop:videoItem];
```


###### 发送图文后回调
```obj-c
-(void)onSendTextImage:(NSString *)text images:(NSArray *)images;
```

###### 发送视频后回调
```obj-c
-(void)onSendTextImage:(NSString *)text images:(NSArray *)images;
```

###### 插入到头部和尾部
```obj-c
//添加到末尾
-(void) addItem:(DFBaseLineItem *) item;

//添加到头部
-(void) addItemTop:(DFBaseLineItem *) item;
```

0 comments on commit 430f428

Please sign in to comment.