I am trying to figure out what settings for the UIImageView below will work with all device sizes.
I'm getting no luck with every combination I've tried.
Here's the .xib:
When I run this on a 4" the image is shifted down much lower from the top label and the buttons stay put.
I have the top label set to Top, tried Aspect Fit/Fill for it as well, didn't change anything. Seems to be an issue with the UIImageView. Also saw someone mention try clip subviews, have that selected, still can't keep it the same size and orientation when going back and forth from 3.5" to 4" iphone on device and simulator.
Hope this helps, in your case you should keep it to the default setting, no change required..
First if turn off the Autolayout setting from XIB.
Now visit my answer here.
Related
I am building a view in Storyboard. I have three parts :
1) top : real-time camera view (adaptive height)
2) middle : small webview (fixed height)
3) bottom : some buttons (fixed height)
I would like to know how to properly make my interface in the storyboard for a compatibility with iPhone 4 or iPhone 5 screens.
My goal is to have the camera having a bigger part of the screen on iPhone 5 (or any bigger screen) and the webview and buttons to have the exact same height on any device.
I did it quite well with the AutoLayout feature. The only problem is that it is available since iOS6 and my app has to work from iOS5 and above.
My Storyboard has an 4' display and when I try to run it on a real device (iPhone 4S) all the bottom of the screen is cropped and I can't see my buttons. I really can't figure it out what is really the best and proper way to do it. For a such simple problem, I shouldn't build two different storyboards.
Maybe should I try to fix the height of the camera view programmatically, but this won't fix the problem of the bottom of the screen cropped on smaller screens (I should then modify the position programmatically).
You can see that I haven't a really nice solution to my problem. Could someone help me in how using well the tools in XCode for this case ?
Thanks
Try this:
Xcode 4.5: How do I fix my text views so they display properly in portrait and landscape mode on an iPad?
I think this could fix your problem and if you are using Storyboards it makes it less difficult.
I just finished up my storyboard based iPhone app (I'm developing on an iPhone 5). Just before submitting it to the Appstore, I thought of making sure everything looks fine on an iPhone 4. So I launch my app in the simulator with iPhone 4.
And what I see baffles me. Basically every single view object, particularly textview, are stacked on top of each other. Basically everything scrollable's messed up. In some textviews even, the initial scroll position has been set to say 100px, which means that the textview's showing the middle of the content in a textview and there'sno way to scroll to top.
Every time I make an ajustments to the storyboard view to fit the iPhone 4, the view on iPhone 5 instead looks weird. Most of the time, the stacked objects on iPhone 4 simulator can't even be unstacked.
Am I the only one experiencing this? I cant find any post about it. Could it be that there's something messed up with my simulator? Any setting I've missed? The only solution I can think of now is to have a seperate SB for iP4 and iP5, but I really would rather not go through the pain of doing that. Any comment or idea is greatly appreciated.
How it looks
You need to make sure that your autosizing struts and springs are set appropriately.
The views need to either dock to the top, or bottom and the views that you want to stretch should have the flexible vertical set.
I'm getting my app ready for the iPhone 5 using the simulator and I've found a weird issue where a couple of my buttons, in one of my views, don't work in the iPhone (Retina 4-inch) simulator, but work fine in the iPhone (Retina 3.5-inch) simulator. The buttons simply don't do anything when they're tapped. Has anyone else experienced this issue?
I having a difficult time figuring out where to start with this one. Any suggestions on where to start?
Thanks so much in advance for all your wisdom!
You need to edit your MainWindow.xib and enable "Full Screen at Launch". For a more detailed explanation, see Apple's docs:
Important: When creating your window in Interface Builder, it is
recommended that you enable the Full Screen at Launch option in the
attributes inspector. If this option is not enabled and your window is
smaller than the screen of the target device, touch events will not be
received by some of your views. This is because windows (like all
views) do not receive touch events outside of their bounds rectangle.
Because views are not clipped to the window’s bounds by default, the
views still appear visible but events do not reach them. Enabling the
Full Screen at Launch option ensures that the window is sized
appropriately for the current screen.
Complete document from Apple
For me, the solution was to set the size ("Simulated Metrics") to "Retina 4 Full Screen" for the MainWindow.xib. I did not need to alter the size of the other screens (they are still set to None). After changing the MainWindow.xib the bottom area becomes clickable again...
The problem was caused by another control overlapping my buttons due to the way the springs and struts were setup. Adjusting the z-order of the buttons fixed the issue. Thanks, all!
There are two solution to this problem :
If you are using MainWindow follow these steps :
a. Select MainWindow.xib.
b. Select Full Screen at Launch from Windows option available in Attributes Inspector.
If your application doesn't contain MainWindow then just add:
self.view.frame = [UIScreen mainScreen].bounds
in ViewDidLoad.
I solved my prob.
view .origin for 3.5 inch and 4 inch screen are different so, when writing common code for both we need to take care at giving CGRectmake(x,y,w,h);
Set temp. diff background color of diff view so you can check if any view is overlapping or not, to fetch event in 4.0 inch.
This may be a very simple issue, but I've been stuck with this for a week. I'm using an UIImageView to display a Dropbox branding PNG image. I see it alright in Interface Builder, but it's easy to notice a strong pixelation in the iOS Simulator and in the actual device (an iPad). Here I attach a screen capture of the IB together with the simulator:
I would really appreciate any hint.
Thanks in advance!
InterfaceBuilder is a completely different environment than iOS or even the simulator. Layout and such should translate, but the way everything looks should always be judged (and therefore designed for) the end product.
It looks like your image is being stretched slightly. There are any number of reasons for this. The first thing to check is the resizing mask on your UIImageView. It's generally bad for UIImageViews to autoresize - for this very reason.
By the way, autoresizing is UIKit's way of making sure that subviews still fit/look good when their parent view changes size. You can specify how much you want a subview to move around, also how much you want it to stretch. Read about it here.
What you will want to do is design your view -- answer the question: how big do I want this image to be in the final product? -- and then make the actual png that size (also produce an #2x variant that is double the size for retina displays). Then, when you design in IB, make your UIImageView that size as well, and make sure that the autoresizing settings are set to prohibit stretching.
This ought to fix your problem.
Check to make sure the size of the image matches the size of your UIImageView. If the image happens to be smaller than the target image view, it will stretch to fill it which could cause pixelation. Also, if you are running the new 5.1 Simulator for iPad, it will default to the new retina screen, which means you will need the #2x sized images to prevent pixelation there.
Can anyone help me with the small buttons/icons used within the iphone apps. I am fairly new to the app world and trying to make some buttons(viz the tick box) for my app. I am not sure if we should start with a 50X50 and autoresize in the app or just have a 20X20 which exactly fits the space...
Any help on this is appreciated..
According to Apple, buttons should be at least 44px wide, and 44px high (unless they're by themselves with nothing near them, in which case 22px high). If you're laying out buttons in IB, I'd say get them placed correctly, and set their 'springs and struts' to autosize for you.
Try to do like this,
Put 50*50 button that you need in your project ,and add an image to your interface builder,
select the image that you put recently in Button attributes and select button size by ctrl+3
and set it to 20*20 it works ,it works for me also...