Last active
December 15, 2015 06:49
-
-
Save externvoid/0fcfac4be6bc345ce533 to your computer and use it in GitHub Desktop.
[2015.01.28 [Swift] カスタムビュー](http://caters.works/2015/01/swift-custom-view/)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
掲題のページを参考に作業する際の注意点 | |
1. Swift1.x系統 | |
2. Attribute Inspectorでsize = Freeformを指定 | |
3. @IBOutlet, @IAOutletを適切に設定しないと | |
fatal error: unexpectedly found nil while unwrapping an Optional value | |
(lldb) | |
で落ちる。 | |
awakeFromNib: CustomViewのインスタンスにaddSubviewするチャンスを提供する。loadNibNamedが呼ばれるまで、@IBOutlet, @IBActionへはアクセスできない。super.awakeFromNibを呼ばなければいけないが、タイミングは何処でも良い。 | |
UITableView用のカスタムセルとか、作るのに便利!! | |
***UINibのinstantiateWithOwnerを使ってもloadNibNamedと同じ事ができそう。 | |
iOSのViewはどうやってつくるべき?storyboardとxibの使い分けについて考えをまとめてみた | |
http://qiita.com/yu_0105/items/4a9c794da4c6261f0f27 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment