ios - OC里__kindof和__typeof有什么区别?
ringa_lee
ringa_lee 2017-04-17 16:44:23
[iOS讨论组]
ringa_lee
ringa_lee

ringa_lee

全部回复(1)
PHP中文网

首先__kindof:规定参数为UITableViewCell这个类或者其子类。比如说一个NSArray<UIView *>*,如果不加__kindof,这个数组只能有UIView,即便是其子类也不行。而加了的话,传入UIImageView或者UIButton之类的不会有问题。
__typeof会返回对应的类型。

The __typeof operator lets you get the System::Type type of a type that you specify. __typeof can also be used to return a value of System::Type in a custom attribute block.

补充两个链接
__kindof
__typeof

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号