1

I have design a view in xib file with 3.5 size. When I run on iphone 5 resolution it show a space in the bottom.

Is there any way to support one xib into both resolution.

Thanks.

EDIT

if( IS_IPHONE_5 )
{
    _helpButton = [[UIButton alloc] initWithFrame:self.view.bounds];
    _LogoImage = [[UIImageView alloc] initWithFrame:self.view.bounds];
    [_helpButton setAutoresizingMask:UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight];
    [_LogoImage setAutoresizingMask:UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight];
    CGRect frameRect = _helpButton.frame;
    frameRect.origin.y += 300;
    _helpButton.frame = frameRect;

}
Arahim
  • 303
  • 1
  • 6
  • 14
  • 1
    check these links: you might find an answer: http://stackoverflow.com/questions/12396143/how-to-add-iphone-5-large-screen-support-to-ios-apps-in-xcode http://stackoverflow.com/questions/12397811/how-do-i-support-the-taller-iphone-5-screen-size http://stackoverflow.com/questions/13582531/iphone5-compatibility-tab-bar-coming-88-points-above-bottom-line-of-screen – user2050128 Feb 07 '13 at 09:27

3 Answers3

3

Either 1) turn on Auto Layout for the xib file and let it automatically adjust depending on the screen height or 2) keep Auto Layout off and then set strings and struts to grow the view depending on it's size or 3) use an outlet and programatically set it's height.

Michael Dautermann
  • 88,797
  • 17
  • 166
  • 215
  • The springs and struts Michael mentions in #2 are also known as an autoresizingMask in code and can be set using a bitmask – eanticev Feb 07 '13 at 07:48
  • Thanks for your reply.. Please share a sample code to change x and y progmaticallay – Arahim Feb 07 '13 at 07:57
  • edit your question to show how (via source code) you get an outlet to either your content view or the background UIImageView of your content view, and then I can help you to adjust the height a bit. – Michael Dautermann Feb 07 '13 at 08:00
  • hey look at that, you're now using "`setAutoresizingMask`". On the other hand, I see you're setting both your helpButton and your logoImage *to the same size as your parent view's frame*. Is that what you wanted to do? In the meantime, start your variables with lower case letters (e.g. "`logoImage`" instead of "`LogoImage`"), it's an Objective C convention. – Michael Dautermann Feb 07 '13 at 08:15
  • Thanks for your tip. no I just want to update y origin on iphone 5. I am doing the in onviewload – Arahim Feb 07 '13 at 09:12
1

Its alright that you have xib for 3.5 inch device, don't use AutoLayout if you supporting iOS<6.0.

You have to just set your UIView resize property like below, the app should work properly without any change.

Auto Resize of View

iphonic
  • 12,615
  • 7
  • 60
  • 107
0

check if you have hardcoded height of your views somewhere

Nikita P
  • 4,226
  • 5
  • 31
  • 55
  • This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. – TemplateRex Feb 07 '13 at 08:09
  • i had the same problem, and i had a hardcoded height value in my code. I thi=ought this might solve the problem, that's y i put it in answers – Nikita P Feb 07 '13 at 09:14
  • 1
    it's recommended that you only put answers for stuff that you /know/ will solve the problem, and put comments to inquire whether your /hunch/ about the hardcoded height was right. – TemplateRex Feb 07 '13 at 09:18