Skip to content

rasping/PresentAnimation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

author
Rasping_reactor
Jan 21, 2017
4a2c167 · Jan 21, 2017

History

29 Commits
Jan 21, 2017
Jan 21, 2017
Oct 14, 2016
Jan 20, 2017
Oct 14, 2016
Oct 14, 2016
Oct 27, 2016

Repository files navigation

PresentAnimation


仿映客刷礼物效果

1. 创建PresentView

PresentView *presentView = [[PresentView alloc] init];
presentView.delegate = self;
presentView.frame = CGRectMake(0, 200, 200, 130);
[self.view addSubview:presentView];

2. 实现代理协议

  • 返回自定义cell样式(required)
- (PresentViewCell *)presentView:(PresentView *)presentView cellOfRow:(NSInteger)row
{
    return [[CustonCell alloc] initWithRow:row];
}
  • 设置cell展示的数据(required)
- (void)presentView:(PresentView *)presentView configCell:(PresentViewCell *)cell sender:(NSString *)sender giftName:(NSString *)name
{
    for (PresentModel *model in self.dataArray) {
        if ([model.sender isEqualToString:sender] && [model.giftName isEqualToString:name]) {
            CustonCell *customCell = (CustonCell *)cell;
            customCell.model = model;
        }
    }
}
  • 监听cell的点击事件(optional)
- (void)presentView:(PresentView *)presentView didSelectedCellOfRowAtIndex:(NSUInteger)index
{
    CustonCell *cell = [presentView cellForRowAtIndex:index];
    NSLog(@"你点击了:%@", cell.model.giftName);
}

3. 属性定制

presentView.showTime = 3.5;
presentView.cellHeight = 35;

4. 收到消息,将消息插入

[self.presentView insertPresentMessages:@[self.dataArray[2]] showShakeAnimation:YES];

效果图如下: 效果图.png

关于Demo的基本逻辑分析,详见:仿映客刷礼物效果---基本逻辑实现

About

仿映客刷礼物效果

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published