日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

点击cell动态修改高度动画

發布時間:2025/5/22 编程问答 30 豆豆
生活随笔 收集整理的這篇文章主要介紹了 点击cell动态修改高度动画 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

點擊cell動態修改高度動畫


?

效果

?

源碼

https://github.com/YouXianMing/Animations

// // TapCellAnimationController.m // Animations // // Created by YouXianMing on 16/4/8. // Copyright ? 2016年 YouXianMing. All rights reserved. //#import "TapCellAnimationController.h" #import "ShowTextCell.h" #import "ShowTextModel.h" #import "CellDataAdapter.h" #import "UIFont+Fonts.h" #import "UIView+SetRect.h"@interface TapCellAnimationController () <UITableViewDelegate, UITableViewDataSource>@property (nonatomic, strong) UITableView *tableView; @property (nonatomic, strong) NSMutableArray *datasArray;@end@implementation TapCellAnimationController- (void)setup {[super setup];[self createDataSource];[self buildTableView]; }#pragma mark - DataSource- (void)createDataSource {self.datasArray = [NSMutableArray array];NSArray *strings = @[@"AFNetworking is a delightful networking library for iOS and Mac OS X. It's built on top of the Foundation URL Loading System, extending the powerful high-level networking abstractions built into Cocoa. It has a modular architecture with well-designed, feature-rich APIs that are a joy to use. Perhaps the most important feature of all, however, is the amazing community of developers who use and contribute to AFNetworking every day. AFNetworking powers some of the most popular and critically-acclaimed apps on the iPhone, iPad, and Mac. Choose AFNetworking for your next project, or migrate over your existing projects—you'll be happy you did!",@"黃色的樹林里分出兩條路,可惜我不能同時去涉足,我在那路口久久佇立,我向著一條路極目望去,直到它消失在叢林深處。但我卻選了另外一條路,它荒草萋萋,十分幽寂,顯得更誘人、更美麗,雖然在這兩條小路上,都很少留下旅人的足跡,雖然那天清晨落葉滿地,兩條路都未經腳印污染。呵,留下一條路等改日再見!但我知道路徑延綿無盡頭,恐怕我難以再回返。也許多少年后在某個地方,我將輕聲嘆息把往事回顧,一片樹林里分出兩條路,而我選了人跡更少的一條,從此決定了我一生的道路。",@"タクシー代がなかったので、家まで歩いて帰った。もし事故が発生した場所、このレバーを引いて列車を止めてください。(丁)為了清楚地表示出一個短語或句節,其后須標逗號。如:この薬を、夜寢る前に一度、朝起きてからもう一度、飲んでください。私は、空を飛ぶ鳥のように、自由に生きて行きたいと思った。*****為了清楚地表示詞語與詞語間的關系,須標逗號。標注位置不同,有時會使句子的意思發生變化。如:その人は大きな音にびっくりして、橫から飛び出した子供にぶつかった。その人は、大きな音にびっくりして橫から飛び出した子供に、ぶつかった。",@"Two roads diverged in a yellow wood, And sorry I could not travel both And be one traveler, long I stood And looked down one as far as I could To where it bent in the undergrowth; Then took the other, as just as fair, And having perhaps the better claim, Because it was grassy and wanted wear; Though as for that the passing there Had worn them really about the same, And both that morning equally lay In leaves no step had trodden black. Oh, I kept the first for another day! Yet knowing how way leads on to way, I doubted if I should ever come back. I shall be telling this with a sigh Somewhere ages and ages hence: Two roads diverged in a wood, and I- I took the one less traveled by, And that has made all the difference. ",@"Star \"https://github.com/YouXianMing\" :)"];for (int i = 0; i < strings.count; i++) {ShowTextModel *model = [[ShowTextModel alloc] init];model.inputString = strings[i];[model calculateTheNormalStringHeightWithStringAttribute:@{NSFontAttributeName : [UIFont HeitiSCWithFontSize:14.f]} fixedWidth:Width - 20];[model calculateTheExpendStringHeightWithStringAttribute:@{NSFontAttributeName : [UIFont HeitiSCWithFontSize:14.f]} fixedWidth:Width - 20];CellDataAdapter *adapter = [CellDataAdapter cellDataAdapterWithCellReuseIdentifier:@"ShowTextCell" data:modelcellHeight:model.normalStringHeightcellType:kShowTextCellNormalType];[self.datasArray addObject:adapter];} }#pragma mark - UITableView- (void)buildTableView {self.tableView = [[UITableView alloc] initWithFrame:self.contentView.bounds];self.tableView.delegate = self;self.tableView.dataSource = self;self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;[self.tableView registerClass:[ShowTextCell class] forCellReuseIdentifier:@"ShowTextCell"];[self.contentView addSubview:self.tableView]; }- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {return self.datasArray.count; }- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {CellDataAdapter *dataAdapter = self.datasArray[indexPath.row];CustomCell *cell = [tableView dequeueReusableCellWithIdentifier:dataAdapter.cellReuseIdentifier];cell.data = dataAdapter.data;cell.dataAdapter = dataAdapter;cell.tableView = tableView;cell.indexPath = indexPath;[cell loadContent];return cell; }- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {ShowTextCell *cell = [tableView cellForRowAtIndexPath:indexPath];[cell changeState]; }- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {CellDataAdapter *dataAdapter = self.datasArray[indexPath.row];return dataAdapter.cellHeight; }@end

細節

總結

以上是生活随笔為你收集整理的点击cell动态修改高度动画的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。