iPhone App not showing up properly on iphone 6 simulator - ios

My app works good on iphone 4s, 5 , 5s simulators. On iphone 6,it shows up weirdly. It does not occupy the entire screen
What could be the issues?

if you are using the Auto resizing just under stand the concept for example
assume that u have a book self , u need to layout the book in the book self so u need to do the following steps
initially arrange the book self (this is your main View).
arrange the all books in inside the book self where u need the location (this is your subview, buttons, labels, all UI Elements).
u keep to follow the above two steps in always. got it
need reference follow the apple tutorial
this tutorial may also help u

The black view is an added view? If the goal is just to set the background color, better to just set the color of the root view.
If you're not using autoLayout (and I don't reccomend it, it's more trouble than it's worth in most cases) one simple to handle different screeen sizes is programatically.
Everything in the view in Interface Builder needs to be an outlet.
in -viewDidLoad, set the center of each view. For example, to center the mobile number text: [self.enterYourMobileNumberLabel setCenter: CGMakePoint(self.view.center.x, self.enterYourMobileNumberLabel.center.y)]
You could also set the frame for more percise handling, etc., using margin constants. Frames are often more code and more cumbersome, but AutoLayout is a nightmare.

Resolved the issue. Thanks for your valuable responses users.It has got nothing to do with Autolayout or autoresizing.
Just go to images.xcassets, right clicking in the navigator area, add launchImage. Then select your project (or target), go to general-->App Icons and Launch images and set Launch Images Source as Launch Image and most importantly, set Launch Screen file blank.
The app would now work well in iphone 6 simulator too.

Related

Building for multiple screen sizes

One screen of my application involves displaying a form - asking the user to enter details which can be posted and saved eventually. In my form, I'm asking for the title, date, description, and attach any images. So there are UILabels, UITextFields, UIButtons, and UITextView involved. And they are displayed using interface builder + constraints.
Now as I view this screen on phones ranging from 8 to XR, I notice, for example in the XR, there is a lot of white space not being utilized. I understand the problem is due to my constraints. How do I adapt my constraints to help with this issue? So in the case of a longer screen such as an XR, my UIViews make use of the space provided rather than being bunched on the top half of the screen. I'm still a beginner w/iOS so I'm assuming it has to do something with constraints but not sure. How can I tackle this issue/change my approach when envisioning iOS applications?
Need some expert to enlighten me w/some iOS wisdom!
It's important to understand how autolayout and constraint works. After that you'll just need to create the UI ONCE in most cases and it will be good for all devices.
Since you're new I suggest putting one object(eg: UILabel) at a time and add constraints on it and see if it works before you add another object
Kindly see this link:
https://developer.apple.com/library/archive/documentation/UserExperience/Conceptual/AutolayoutPG/index.html
and there are a lot of tutorial videos in youtube you can watch.
happy coding

All iOS screen size compatibility?

New to iOS developing here. Basically I am creating a soundboard app. I have the app essentially working (aka buttons returning sounds).
However my app only looks proper on the iPhone 6. I just have one ViewController in my main storyboard. When I run the simulator for the 4S/5/6+ or iPads, my buttons are pretty much everywhere.
I tried playing with size classes/autolayout through Apple's documentation, but couldn't get it working properly. What's the best (easiest ;) ) route I can follow to have it basically looking the same on ALL devices?
PS: I have one background placed too, I don't mind if it looks different on all devices since it's pretty minimalistic, but if someone can shed some light here too, that would be great.
Thanks!
You have a few options:
1) Continue your plan spending time getting friendly with Auto Layout and Size Classes. This might be difficult at first, but it will really pay off later. You should use the Assistant Editor's Preview mode to let you see iPhone 4, 5 and 6 side-by-side as you work so you can make sure your layouts look great everywhere.
2) Use a component like UIStackView where layouts are automatically adjusted to fit various devices. If your soundboard is as simple as a grid of buttons, you can do that in just a few minutes using a stack view.
3) Use a component like UITableView or UICollectionView where content is designed to scroll. Using this method you design only one sound button of your app (i.e., enough to play one sound) then have iOS replicate that across all the sounds you want. When your interface is presented on a device of a different size iOS will just make the content scroll.
Very roughly, option 1 makes you do all the work; option 2 makes your layout shrink down until it fits the available space; and option 3 makes your layout stay the same size no matter what, but you should expect it to scroll on some devices.
There is no right solution; it's entirely down how you want your app to work.

iOS Launch Screen Image not always showing

I use a Launch Screen (xib) in my app to overcome the problem of the resizeable screen, since i don't always want add Launchscreens everytime, Apple create a new iPhone with a different screen resolution.
In my launchscreen, i placed a UIImageView directly in the center of the view using constraints. The image shows the logo of the company i work for.
The problem is, that sometimes the image is being hidden (mostly after install and first launch) and sometimes it shows (mostly after a view times using it). I'm not quite sure, what the problem is. Is it because at the first-launch-time(s) it has to load many ressources?
Figured out the problem: It seems, that if there isn't enough disc space left on the device, it doesn't show the xib's (Launch-Screen's) Image. iOS at some point clears out some disc-space (i guess from NSLibraryDirectory) and than the images show again.
If this is a major problem to any of your apps, use Launch-Images instead.

previewing autolayout with different sizes and language styles

I've started learning the new Auto Layout stuff in XCode on iOS. Auto Layout is actually quite neat, but it appears to be a pain to test. I seem to remember on the Mac side there was a way you could Preview an interface and drag it to different sizes to test if controls lined up properly. Is there anything like this for iOS or some tool to facilitate testing your AutoLayout views? Additionally, something to switch to Right to Left would be useful too. I just want to test all my constraints and make sure they're perfect.
To view a preview of what Auto Layout will do under different conditions, do the following in Xcode 5:
Open up a storyboard.
Open the assistant editor (as many as you want).
In the assistant editor, tap the 4th button (the one that says Manual/Automatic/etc).
Choose "Preview".
You can now use the controls on the bottom right to customize:
the iOS version (6 or 7)
device rotation (portrait or landscape)
device screen size (3.5" or 4")
To simulate a right-to-left language, according to the WWDC 2012 Auto Layout by Example (Session 232) video:
Set the following arguments: (using a method such as this)
AppleTextDirection YES
NSForceRightToLeftWritingDirection YES
More arguments that can help with Auto Layout can be found here.
If you have localized strings, you can go to the Xcode Product menu then pick Scheme ---> Edit Scheme. In the top section on the right (Arguments Passed On Launch), click the + button and then type in: -NSDoubleLocalizedStrings YES and make sure the check box next to it is checked. This will double all your localized strings to simulate a language like German that tends to have long words.
Thanks to Apple we have the live preview in the new XCode 5.
One option for iOS i've found is to set Status Bar to None on root View of the XIB. This will remove the black status bar and show resize handles. This way you can drag the frame around and see how the controls behave. It still won't run code though. Also, I haven't found out how to enable Right-To-Left text yet.

Why does the iOS Simulator show only a blank view/window?

I'm new to iOS development. I used the Interface Builder to add text fields and buttons to my view. When I run the app, the iOS Simulator only shows an empty beige screen. What am I missing? The console doesn't show any error.
It is because you have not connected your view to your File's Owner.
To do this Right Click on the View, Control Click on the Oultlet of your View and drag it to the File Owner.
This shall solve your problem.
Cheers
I reckon it's because you have AutoLayout turned on in your storyboard, but haven't set any constraints.
Follow my instructions in the following article, to confirm if this is true.
AutoLayout problem
Basically, with XCode 6, if you have AutoLayout turned on, you must set constraints on every single control... otherwise your screens will look fine within XCode, but the controls in your screen could (and will) end up anywhere and in any size when the app is run.
It's like designing a beautiful webpage, then displaying it in an angry, drunk, disorientated browser.
XCode is really unintuitive, and unhelpful for beginners... but once you learn the rules of AutoLayout (along with its many quirks), it's reasonable useful.

Resources