仿微信朋友圈UITableViewCell中文字展开收起功能
最近做社交APP涉及到一个功能,用户发表长文字后显示一定行数,超出一定行数后显示“更多”按钮,同时用户点击后展开文字,再点击收起内容;参考一下朋友圈的交互效果做了个demo,其中关键在于UILabel行数的计算,考虑到不同文字占用字符数不同,并且包含表情等,使用CoreText计算更为合适;
核心思路是通过coreText计算UILabel当前显示文字所需要的行数,如果大于最大行数就设置numberOfLines;
This project forked from lumianie/foldlabeldemo
仿微信朋友圈UITableViewCell中文字展开收起功能
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.