In my iPhone app, my navigation bar image width does not change properly when transitioning to landscape. I'm using an image sized 480 X 34. Please, someone help me.
check your image size.....if less or more than make it 480*34
Related
I am using iOS7 and I have a UIViewController with a UIImageView that fill the screen in Aspect Fit mode.
In portrait mode the image looks good but in landscape mode the image is off screen.
Can anyone help me?
Thanks ;-)
As you can see the image is in the same position in both orientations. It's the same distance away from the top panel and pushed up against the left side of the screen. iOS doesn't automatically change the frame of the image for you when you change orientations. You have to either do it programmatically or use auto layouts to achieve the display you want.
AutoLayout Guide
Autolayout is a pain to learn at first but stick with it. It's a great solution when you get the hang of constraints and start modifying them programatically. In fact it's recommended you never set the frame explicitly, you should always use constraints to position and size frames.
As Literphor mentioned above. it is layout issue. Either use autolayout or do the trial and error (because you are not familiar with Autosizing) with settings shown in below image. That should fix the issue.
self.imageView.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin |
UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin;
You must "play" with autoresizingMask
I am making iOS 7 app where I am finding width and height in landscape mode.
What I have is below in app delegate...
NSLog(#"self.window.frame.size.width==%f", self.window.frame.size.width);
NSLog(#"self.window.frame.size.height==%f", self.window.frame.size.height);
What I was expecting is
self.window.frame.size.width==1024
self.window.frame.size.height==768
However I get reversed output as
self.window.frame.size.width==768
self.window.frame.size.height==1024
Note: I have ticked ONLY Landscape Left and Right. I have not selected Potrait & Upside Down.
Any idea why this is happening?
I am doing this on iOS 7.
The width and height of the screen and of the window in the screen don't change as the screen orientation changes, they will always be width = 768 and height = 1024 (until Apple makes an iPad with more pixels, like the height of iPhone's has changed).
In that screen window, you have a view controller with a root view. The size of that view will change with the screen orientation.
I have an app of photo catalog on my iPhone.
This app shows three images on screen with scrollview.
I want to enlarge/shrink the image size when I am scrolling.
I want to expand the image size when the image is centered.
And draw the image smaller when scrolled away from center to right/left.
I think this behaviour needs to developed in scrollViewDidScroll.
Do you know how to do this effect?
so you want a Coverflow ,
iCarousel may be the best control for it
take a look https://github.com/nicklockwood/iCarousel
I have images of size 320 x 480. I left a blank space at the bottom of these images to account for the tab bar at the bottom of the iPhone screen.
The 320 x 480 looks good on the iphone in portrait mode but it looks stretched on landscape mode.
These images are loaded programmatically.
What can I do to not having them look stretched and perhaps how to use a higher resolution.
My understanding is that a higher resolution means the image will be too big for the iPhone screen.
Thank you.
I presume you are using UIImageView. By default the contentMode property of any imageView is set to UIViewContentModeScaleToFill that means it will fill the entire view thereby stretching the image.
change this to - [imgView setContentMode: UIViewContentModeScaleAspectFit], what this does is to respect the aspect ratio of the image.
more here in apple docs
The screen Size of iPhone and iPad are given below. Based on the mode you can create image size.
iPhone:
Portrait : 320x460
Landscape : 480x300
iPad:
portrait : 768x1004
Landscape : 1024x748
In my iPhone app, I've put an image sized 480 x 44 in the navigation bar, but when I change to landscape, the image becomes shorter. Please someone help me.
The image size is reduced because the navigation bar has a different size in landscape mode and it crops the portrait one (44px height).
Should be 32 pixels in height in landscape.
I would make 2 different versions of the image (landscape and portrait mode) and then implement -willAnimateRotationToInterfaceOrientation to select the appropriate version.