在我的应用程序中,我必须根据每个视图垂直布局两个视图,并希望确保它们在 iPhone 4 和 5 中看起来相似。这是代码:
nextShowView = [[WestwoodNextShowView alloc]initWithFrame:CGRectMake(-5, 322, 290, 70)];
nextShowView.staticLabel.text = @"Next Show";
nextShowView.date.text = @"10/25";
nextShowView.address.text = @"Green Dot Tavern";
nextShowView.cityState.text = @"Detroit, MI";
[_aboutScroll addSubview:nextShowView];
playerView = [[WestwoodMusicPlayerView alloc]initWithFrame:CGRectMake(0, 407, 320, 50)];
[_aboutScroll addSubview:playerView];
NSDictionary * viewsDict = NSDictionaryOfVariableBindings(nextShowView, playerView);
NSArray * constraints = [NSLayoutConstraint constraintsWithVisualFormat:@"V:[nextShowView]-15-[playerView]-20-|" options:NSLayoutFormatAlignAllLeft metrics:nil views:viewsDict];
[_aboutScroll addConstraints:constraints];
我试图做的是在 nextShowView 和 playerView 之间留出 15 点空间,从 playerView 底部到视图底部边缘留出 20 点空间。
请帮忙 !!!!
谢谢,