美文网首页iOS
代码还可以这样写

代码还可以这样写

作者: WarMap | 来源:发表于2016-03-28 11:34 被阅读120次

    1.数组(摘自UITableView-FDTemplateLayoutCell)

    static const CGFloat systemAccessoryWidths[] = {
        [UITableViewCellAccessoryNone] = 0,
        [UITableViewCellAccessoryDisclosureIndicator] = 34,
        [UITableViewCellAccessoryDetailDisclosureButton] = 68,
        [UITableViewCellAccessoryCheckmark] = 40,
        [UITableViewCellAccessoryDetailButton] = 48
    };
    contentViewWidth -= systemAccessoryWidths[cell.accessoryType];
    

    2.宏定义 (出处同上)

    static void __FD_TEMPLATE_LAYOUT_CELL_PRIMARY_CALL_IF_CRASH_NOT_OUR_BUG__(void (^callout)(void)) {
        callout();
    }
    #define FDPrimaryCall(...) do {__FD_TEMPLATE_LAYOUT_CELL_PRIMARY_CALL_IF_CRASH_NOT_OUR_BUG__(^{__VA_ARGS__});} while(0)
    

    看半天没想明白为啥要用只执行一次的do {...} while (0),问了下作者然后查了下资料,下面给出直达解释的机票.直达机票

    相关文章

      网友评论

        本文标题:代码还可以这样写

        本文链接:https://www.haomeiwen.com/subject/mhujlttx.html