1
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Swift備忘録

Posted at

#思ったこと・気づいたことを書きなぐる

  • Viewの階層を調べる
     → view.performSelector("recursiveDescription")

  • ViewのAutoLayoutを調べる
    → 垂直方向:constraintsAffectingLayoutForAxis(.Vertical)
    → 水平方向:constraintsAffectingLayoutForAxis(.Horizental)

  • tryがあるのにcatchが無いのはなぜ?
    →「do { try xxx }catch」が基本構文
     「try!」で記載した場合はエラーが起こらないものという明示的な表記になる

  • [weak self]と[unowned self]について
    → ボタンタップなどの同期処理にはunowned
    → クロージャーやハンドラーなど非同期処理の場合はweakにする
     ┗ 非同期処理内でselfを参照したい場合は以下のようにunwrapしておく
    guard let `self` = self else { return }

  • タブ切り替えなどでaddChildViewControllerをした場合
    → そのあと必ずdidMoveToParentViewControllerの記載を忘れないようにする

1
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?