zoukankan      html  css  js  c++  java
  • swift开发笔记21

    let frame = CGRect(x: xOffset[column], y: yOffset[column], columnWidth, height: height)

    let insetFrame = frame.insetBy(dx: cellPadding, dy: cellPadding)

    attributes.frame.intersects(rect)

    ceil(rect.height)

    Variable 'photos' passed by reference before being initialized

    var photos: [Photo]

    if let photo = photo

    Class 'AnnotatedPhotoCell' has no initializers

    Initializer for conditional binding must have Optional type,

    // 类方法

    class func allPhotos() -> [Photo] {}

    if let patternImage = UIImage.init(named: "Pattern") {
      view.backgroundColor = UIColor.init(patternImage: patternImage)
    }

    // model刷新UI;
    var photo: Photo? {
    didSet{
    if let photo = photo {
    imageView.image = photo.image
    captionLable.text = photo.caption
    commentLabel.text = photo.comment
    }
    }
    }

    DESIGNATED,CONVENIENCE 和 REQUIRED

     http://swifter.tips/init-keywords/

  • 相关阅读:
    41:和为S的两个数
    40:数组中只出现一次的数字
    39-2:平衡二叉树
    39:二叉树的深度
    38:数字在排序数组中出现的次数
    37:两个链表的第一个公共结点
    36:数组中的逆序对
    35:第一个只出现一次的字符
    34:丑数
    33:把数组排成最小的数
  • 原文地址:https://www.cnblogs.com/dengchaojie/p/8080806.html
Copyright © 2011-2022 走看看