Ios - 3.5 "cutting off the bottom of the screen

I have an application that cuts out the bottom toolbar for a 3.5-inch screen (add or update photos panel in the screenshots below). For a 4-inch screen, everything works fine.

This only happens when the application starts in the simulator. The storyboard preview looks great for both 4 "and 3.5". enter image description hereenter image description hereenter image description hereenter image description here

I suspect problems with auto-layout, but I really don't know how to approach the problem, how good this is in the storyboard view. What is the correct approach - using autostart to reduce the size of a table with a smaller vertical size?

Thanks for any help!

+7
autolayout ios7
source share
3 answers

First you need to uncheck the box in the storyboard, which is turned on or checked by default in iOS 7

Set edges of view

Finish if the problem is not resolved, you need to enable Auto-layout in the storyboard by setting the option shown in the figure below.

select tab

&

Enable autolayout

Update 1

If you want to apply the restriction, follow these steps:

Step 1

Step 2

Step 3

& if it gives any warnings or errors, add other required restrictions

+9
source share

I solved this problem by doing this.

I have a series of macros (thanks to someone else to answer stackoverflow a few months ago) that I use to determine which device is being used. It:

#define IS_IPAD (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) #define IS_IPHONE (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) #define IS_IPHONE_5 (IS_IPHONE && [[UIScreen mainScreen]bounds].size.height == 568.0f) 

I know that some people are against using macros for a good reason, but I find them useful in some cases. So, to be thorough, macros can be written as methods.

 -(BOOL)isIpad {return UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad ? YES : NO;} -(BOOL)isIphone {return UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone ? YES : NO;} -(BOOL)isIphone5 {return ([self isIphone] && [[UIScreen mainScreen]bounds].size.height == 568.0f) ? YES : NO;} 

I put them in a .h file, which I use specifically for macros called ResourceConstants.h. I import this file into any class in which I should use them.

Once they are defined, go to your -viewDidLoad method in the view controller and set the view angle as follows:

 if (IS_IPHONE) self.view.frame = CGRectMake(0, 0, 320, 480); 

- EDIT - You may also need to adjust the placement / size of objects / widgets on the screen, since the entire screen is half smaller. You can do this the same way once you create property exits on your view controller to reference any objects on the screen that you need to change. Thus,

  self.myobject.frame = CGRectMake(myTopLeftCornerXCoord, myTopLeftCornerYCoord, myWidth, myHeight); 

Hope this helps! :)

0
source share

Thanks to Claric, I didn’t know about the simulated metrics settings. But this didn’t really solve the problem ...

But I decided to solve the problem by removing all my limitations and creating them again. Then he magically worked.

0
source share

All Articles