您似乎正在更新您的Parse loginView。我遇到了同样的问题……让默认的 loginView 适合所有屏幕设备尺寸真的很痛苦。我将分享一些希望对您有所帮助的代码。这应该在 Parse 的 IOS Helper Page 上。 将其放入您的 .m 文件中
- (void)viewDidLayoutSubviews {
[super viewDidLayoutSubviews];
//Returns the screen dimensions (in points) of the user's current device
CGRect screenBounds = [[UIScreen mainScreen] bounds];
//Finds to see if the user has an iPhone 4s, and then set's the layout if they do
if(screenBounds.size.height==480)
{
[self.logInView.logInButton setFrame:CGRectMake(self.view.center.x - 125, 300.0f, 250.0f, 50.0f)];
[self.logInView.usernameField setFrame:CGRectMake(self.view.center.x - 125, 165.0f, 250.0f, 50.0f)];
[self.logInView.passwordField setFrame:CGRectMake(self.view.center.x - 125, 215.0f, 250.0f, 50.0f)];
[self.logInView.passwordForgottenButton setFrame:CGRectMake(self.view.center.x - 125, 265.0f, 250.0f, 40.0f)]; }
//Finds to see if the user has an iPhone 5/5s, and then set's the layout if they do
else if (screenBounds.size.height == 568)
{
[self.logInView.logInButton setFrame:CGRectMake(self.view.center.x - 125,360.0f, 250.0f, 50.0f)];
[self.logInView.usernameField setFrame:CGRectMake(self.view.center.x - 125, 245.0f, 250.0f, 50.0f)];
[self.logInView.passwordField setFrame:CGRectMake(self.view.center.x - 125, 295.0f, 250.0f, 50.0f)];
[self.logInView.passwordForgottenButton setFrame:CGRectMake(self.view.center.x - 125, 445.0f, 250.0f, 40.0f)]; }
//If the user doesn't have a 4S/5/5s, then they must be using an iPhone 6/6+
else {
[self.logInView.logInButton setFrame:CGRectMake(self.view.center.x - 125, 420.0f, 250.0f, 50.0f)];
[self.logInView.usernameField setFrame:CGRectMake(self.view.center.x - 125, 275.0f, 250.0f, 50.0f)];
[self.logInView.passwordField setFrame:CGRectMake(self.view.center.x - 125, 325.0f, 250.0f, 50.0f)];
[self.logInView.passwordForgottenButton setFrame:CGRectMake(self.view.center.x - 125, 485.0f, 250.0f, 40.0f)];
//Prints out the current device being used
NSLog(@"Current device: %@", [[UIDevice currentDevice] model] );
}