iPhoneの画面サイズはすっかり大きくなった。
大きいサイズでレイアウトしていると3.5インチに収まらくなる時がある。
そんな時はこっそり広告とかを消しちゃおう。
1 2 3 4 5 6 |
//画面サイズによるnendの広告表示非表示 NSLog(@"%f",[[UIScreen mainScreen] bounds].size.height); if ([[UIScreen mainScreen] bounds].size.height == 480.000000) { self.bannerView.hidden = YES ; } |
良いのかな?
追記
参考ページ
Auto Layoutでsubviewを動的に非表示にしたときのマージンをどうにかする – 悪あがきプログラマー
マージンのプロパティを作って消したらなお良し。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *banerView3topConstraint; @property (weak, nonatomic) IBOutlet NSLayoutConstraint *banerView3bottomConstraint; @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. //画面サイズによるnendの広告表示非表示 NSLog(@"%f",[[UIScreen mainScreen] bounds].size.height); if ([[UIScreen mainScreen] bounds].size.height == 480.000000) { self.bannerView3.hidden = YES ; self.banerView3topConstraint.constant = 0.f; self.banerView3bottomConstraint.constant = 0.f; } } |