PFLoginViewController
以下のコードでアプリをサブクラス化しました。5S または 6 デバイスでは、すべてが正常に表示されます。ただし、4S 以下のデバイスでは、一部のボタンが高すぎたり、低すぎたりして、[サインアップ] ボタンさえ見えないほどです。誰かが私のフレーミングをチェックして、すべてのデバイスにすべてフィットするようにするためのより良い方法があるかどうかを確認してもらえますか?
- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = [UIColor blackColor];
UIImageView *logoView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"AppIcon76x76@2x.png" ]];
self.logInView.logo = logoView; // logo can be any UIView
self.fieldsBackground = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"LoginFieldBG.png"]];
UITextView *iprayed = [[UITextView alloc] initWithFrame:CGRectMake(0, 120, 320, 40)];
iprayed.text = @"iPrayed 4 U";
iprayed.textAlignment = NSTextAlignmentCenter;
iprayed.textColor = [UIColor whiteColor];
iprayed.backgroundColor = [UIColor blackColor];
UIFont *cellFont = [UIFont fontWithName:@"Verdana-Bold" size:25];
iprayed.font = cellFont;
[self.logInView addSubview:iprayed];
[self.logInView insertSubview:self.fieldsBackground atIndex:1];
}
- (void)viewDidLayoutSubviews {
[super viewDidLayoutSubviews];
CALayer * l = [self.logInView.logo layer];
[l setMasksToBounds:YES];
[l setCornerRadius:40];
[l setBorderWidth:2.0];
[l setBorderColor:[[UIColor whiteColor] CGColor]];
// Set frame for elements
[self.logInView.dismissButton setFrame:CGRectMake(10.0f, 10.0f, 87.5f, 45.5f)];
[self.logInView.logo setFrame:CGRectMake(120, 40, 80, 80)];
[self.logInView.facebookButton setFrame:CGRectMake(35.0f, 400.0f, 120.0f, 40.0f)];
[self.logInView.twitterButton setFrame:CGRectMake(35.0f+130.0f, 400.0f, 120.0f, 40.0f)];
[self.logInView.signUpButton setFrame:CGRectMake(35.0f, 490.0f, 250.0f, 40.0f)];
[self.logInView.usernameField setFrame:CGRectMake(35.0f, 175.0f, 250.0f, 50.0f)];
[self.logInView.passwordField setFrame:CGRectMake(35.0f, 225.0f, 250.0f, 50.0f)];
[self.fieldsBackground setFrame:CGRectMake(35.0f, 175.0f, 250.0f, 100.0f)];
[self.logInView.passwordForgottenButton setFrame:CGRectMake(0.0f, 200.0f, 35.0f, 40.0f)];
}
iPhone 5S:
アイフォーン4エス: