Skip to content

Commit

Permalink
add README
Browse files Browse the repository at this point in the history
  • Loading branch information
takasek committed Oct 16, 2018
1 parent 950d006 commit a7f9b7f
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
4 changes: 2 additions & 2 deletions DesignableSample/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" verticalHuggingPriority="1000" axis="vertical" spacing="5" translatesAutoresizingMaskIntoConstraints="NO" id="M6O-H7-3Lc">
<rect key="frame" x="0.0" y="-6" width="375" height="679"/>
<rect key="frame" x="0.0" y="116" width="375" height="435.5"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="R3J-Oq-uUE" customClass="HogeView" customModule="DesignableSample" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="375" height="100.5"/>
Expand All @@ -30,7 +30,7 @@
</userDefinedRuntimeAttributes>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="z5O-jO-diT" customClass="HogeView" customModule="DesignableSample" customModuleProvider="target">
<rect key="frame" x="0.0" y="212" width="375" height="467"/>
<rect key="frame" x="0.0" y="212" width="375" height="223.5"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="title">
<string key="value">長い長いタイトル長い長いタイトル長い長いタイトル長い長いタイトル長い長いタイトル長い長いタイトル長い長いタイトル長い長いタイトル長い長いタイトル長い長いタイトル長い長いタイトル長い長いタイトル長い長いタイトル長い長いタイトル長い長いタイトル長い長いタイトル長い長いタイトル</string>
Expand Down
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# DesignableSample

## プロジェクトの目的

1. xibでデザインしたViewのサブクラスを、Storyboardあるいはxibから利用する方法を示す
2. xibあるいはコードでinitされたViewが内部的に呼ぶメソッドのライフサイクルの調査

## わかったこと

IBでレイアウトされているなら `init(coder:)` で、コードでinitされたなら `init(frame:)` だと思い込んでいたが、違った。

初期化経路 | 実行環境 | 呼ばれるinit
--- | --- | ---
コード | Any | `init(frame:)`
Interface Builder | Xcode上で開く | `init(frame:)`
Interface Builder | アプリ実行時 | `init(coder:)`

証拠画像はこちら

![証拠写真](img/image.png)
Binary file added img/image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit a7f9b7f

Please sign in to comment.