私のアプリでは、2 つのビューをそれぞれに応じて垂直にレイアウトする必要があり、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 ポイントのスペースを空けることです。
助けてください !!!!
ありがとう、