iOS/iPhone/iPad/watchOS/tvOS/MacOSX/Android プログラミング, Objective-C, Cocoa, Swiftなど
何故、透明にならないのか?自動で背景ビューが挿入されるのか?と考えて、以下のメソッドでビュー構造をダンプしてみた。
- (void)dumpView:(id)aView level:(int)level
{
for (int i = 0; i < level; i++) printf("\t");
printf("%s\n", [[NSString stringWithFormat:@"%@", [[aView class] description]] UTF8String]);
for (int i = 0; i < level; i++) printf("\t");
printf("%s\n", [[NSString stringWithFormat:@"%@", NSStringFromCGRect([aView frame])] UTF8String]);
for (UIView *subview in [aView subviews]) {
[self dumpView:subview level:(level + 1)];
}
}
結果は以下のとおり。
UIView
{{0, 20}, {320, 460}}
UIView
{{60, 130}, {200, 200}}
UIRoundedRectButton
{{20, 143}, {72, 37}}
UIButtonLabel
{{24, 9}, {23, 19}}
UIRoundedRectButton
{{108, 143}, {72, 37}}
UIButtonLabel
{{20, 9}, {31, 19}}
自動で背景ビューが挿入されている訳ではないようだ。