zoukankan      html  css  js  c++  java
  • ios9 新关键字 __kindof 等(etc) 小结

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

    if marked as __kindof,  that the compiler won't complain if you try to access ones of its elements, and store the result in a variable who's type is UIView or one of its subclasses.

    参考链接:

    1.https://happyteamlabs.com/blog/how-to-use-__kindof-in-objective-c/

    2.https://stackoverflow.com/questions/31399208/ios-kindof-nsarray/33013094#33013094

    3.http://www.jianshu.com/p/3f73e696dd4d

    4.http://www.itstrike.cn/Question/b06eefce-1d13-4ace-a8db-a93e36fe2634.html

    5.https://www.infoq.com/articles/whats-new-ios9-swift-objc

  • 相关阅读:
    最大子数组
    链表插入排序
    链表求和
    有效回文串
    排球比赛计分系统
    超市收银系统
    三层架构
    Wpf+数据库代码封装+策略模式封装
    封装逻辑用策略模式实现
    代码封装
  • 原文地址:https://www.cnblogs.com/Jenaral/p/6145257.html
Copyright © 2011-2022 走看看