谁能向我解释您在下面的屏幕截图中看到的边距来自哪里?我希望红色、绿色和蓝色矩形在屏幕布局、横向和纵向中都彼此相邻。相反,我在视图之间看到了莫名其妙的边距。
// 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]];
我用这段代码看到的:
真正让我感到困惑的是,随着可用空间变小,视图之间的边距变得越来越大?我不明白他们为什么在那里,也不明白为什么他们的行为与我对利润的期望背道而驰。
谢谢!