本篇文章主要介绍了"iOS聊天界面cell从下至上滚动",主要涉及到cell,IOS方面的内容,对于IOS开发感兴趣的同学可以参考一下:
import "ChatView.h"import "ChatCell.h"@interface ChatView () @property (nonatomi...
(UITableViewCell )tableView:(UITableView )tableView cellForRowAtIndexPath:(NSIndexPath
)indexPath
{
static NSString identifier = @"LiveChatCell";
ChatCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];
if (!cell) {
cell = [[ChatCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier];
}
cell.contentView.transform = CGAffineTransformMakeScale(1, -1);
NSInteger index = self.dataSoure.count-1-indexPath.row;
cell.item = self.dataSoure[index];//cell填充数据
return cell;
}
(CGFloat)tableView:(UITableView )tableView heightForRowAtIndexPath:(NSIndexPath
)indexPath
{
NSInteger index = self.dataSoure.count-1-indexPath.row;
return [ChatCell cellHeightWithItem:self.dataSoure[index] tableView:tableView];
}
pragma mark - UIScrollViewDelegete
//开始拖拽
- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView
{
[NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(scrollStopTime) object:nil];
}
//结束拖拽
(void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate
{
[self performSelector:@selector(scrollStopTime) withObject:nil afterDelay:3.0f];
}
(void)scrollStopTime
{
[self.tableView scrollRectToVisible:CGRectMake(0, 0, 1, 1) animated:YES];
}
@end
以上就介绍了iOS聊天界面cell从下至上滚动,包括了cell,IOS方面的内容,希望对IOS开发有兴趣的朋友有所帮助。
本文网址链接:http://www.codes51.com/article/detail_581430_2.html