以下のスクリーンショットに表示されているマージンがどこから来ているのか、誰かに説明してもらえますか?赤、緑、青の長方形を、横向きと縦向きの両方の画面レイアウトで並べて配置したいと思います。代わりに、ビュー間に不可解なマージンが表示されます。
// Setup Left Bar Button item
UIBlankToolbar* tools = [[[UIBlankToolbar alloc] initWithFrame:CGRectMake(0, 0, 115, 44)] autorelease];
tools.autoresizingMask = UIViewAutoresizingFlexibleWidth;
[tools setBackgroundColor:[UIColor greenColor]];
self.navigationItem.leftBarButtonItem = [[[UIBarButtonItem alloc] initWithCustomView:tools] autorelease];
...
// Setup Right Bar Button Item
UIBlankToolbar* tools = [[[UIBlankToolbar alloc] initWithFrame:CGRectMake(0, 0, 100, 44)] autorelease];
[tools setAutoresizingMask:UIViewAutoresizingFlexibleWidth];
[tools setBackgroundColor:[UIColor redColor]];
self.navigationItem.rightBarButtonItem = [[[UIBarButtonItem alloc] initWithCustomView:tools] autorelease];
...
// Setup Title View
self.navigationItem.titleView = [[[UIView alloc] initWithFrame:CGRectMake(0, 0, 50, 44)] autorelease];
self.navigationItem.titleView.autoresizingMask = UIViewAutoresizingFlexibleWidth;
[self.navigationItem.titleView setBackgroundColor:[UIColor blueColor]];
このコードで私が見るもの:
私が本当に困惑しているのは、使用可能なスペースが小さくなるにつれて、ビュー間のマージンが大きくなることです。なぜ彼らがそこにいるのか、なぜ彼らがマージンから期待するものに反して振る舞うのか理解できません。
ありがとう!