All Posts

  • Published on
    This code shows a Swift delegate example. It defines a `ModelDelegate` protocol with methods. The `Model` class has a delegate property and a `count` variable. The `View` class conforms to the protocol and implements the methods. An instance of `Model` and `View` is created, and the delegate is set. The `count` property is changed, triggering the delegate methods.
  • Published on
    2017 年 6 月 10 日,关于 swift UILabel 不显示 html 标签的讨论。通过将带 html 标签的文本转成 NSAttributedString 并设置给 label 的 attributedText 来尝试显示,但未成功。
  • Published on
    2017 年 6 月 10 日的文章介绍 swift UITableView cell 自适应高度。ios8 支持,需在 viewDidLoad 中设置 estimatedRowHeight 和 rowHeight,在 cellForRowAtIndexPath 中设置 textLabel 的行数和宽度,heightForRowAtIndexPath 设为 UITableViewAutomaticDimension。
  • Published on
    介绍网页聊天气泡效果实现,通过 ejs 模板实现收发消息布局,利用 flex 布局和特定样式打造左右对齐气泡,包含头像、名字、聊天内容等部分,文末提供 github 地址。