Comments (3)
#41 Merged.
谢谢,这的确是一个便利方法,但我不认同你的阐述,Index 是始终唯一的而业务数据不是。
具体来讲,buttonIndex 是可以唯一标识每一个 button 的,而 buttonTitle 不会,buttonTitle 在逻辑上是允许相同的(当然一般业务上应该不允许)。比如给一个特定条件查找数组中的某个变量,一般函数设计都是返回该变量下标,而不是直接返回该变量(这也涉及微小的 I/O 优化)。
至于可读性,#41 提供的方法我认为是 convenience。每一个 title 都是外部传给 actionSheet 的,在明确 index 的情况下获取 buttonTitle 其实并不需要通过 actionSheet:
初始化 actionSheet 时:
| 外部 | -- titles --> | actionSheet |
↑ 外部是明确持有所有 titles 的,并在初始化 actionSheet 时传递给了 actionSheet
根据 index 获取 title:
外部持有所有 titles,直接根据 index 获取对应 title 即可,并不需要把通过 index 去 actionSheet 中读取再返回该 title。
from lcactionsheet.
是的下标的确是不可或缺的,大神研究的很专业,学习了,我没有想那么多,哈哈.只是在用的时候发现一些.
from lcactionsheet.
过奖,相互学习吧。
from lcactionsheet.
Related Issues (20)
- 请尽快新版本,十万火急 HOT 5
- 区分点击空白区域或cancelButton HOT 1
- without title HOT 3
- 并没有适配iphoneX HOT 3
- 最大高度问题? HOT 3
- 能自定义每一行按钮的颜色吗? HOT 1
- 挺好用的 HOT 1
- carthage install error HOT 1
- pod 报错 HOT 2
- iphonexs and iphonexMax screen adaptation HOT 3
- 为什么3.5.1版本没有呢?最新的是3.5.0 HOT 1
- 用clicked的block形式,会与SVProgressHUD冲突 HOT 2
- 释放不掉UIwindow
- 项目太依赖Masonry,有的用的SnpKit。导致还得导入两个库。不划算 HOT 1
- 希望可以自定义页面UI,比如可以设置圆角这些。方框太丑了
- lc_isX 方法建议改下 下次出个别的高度又要改
- 建议添加的需求-圆角。👇 HOT 4
- 怎样设圆角
- 设置取消按钮的背景色无效
- hey, why exec [actionSheet show]; not show HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lcactionsheet.