I'm a beginner iOS programmer and I guess this is a newbie question.
Are you allowed to ignore warnings when placing views in storyboard if the autolayout is working as expected - warnings like misplaced view or ambiguous height?
Is the app going to work even if I don't fix the warnings and will that app be published?
It seems that the layout may get distorted on some devices if the warnings are ignored. The display of the simulator is not accurate and the app must be tested on actual devices.
All credits for the answer go to Raptor for answering in the comments.
Related
I'm unable to build an interface I want to build as the objects does not obey the constraints I place on them.
Clarification to this who do not understand the question above:
I want what I see in Xcode on all devices, no matter the constraints on a iPhone 7+ and I assume a 7 and lower the image is either stretched or reshaped.
iphoneX simulator renders correctly
iPhone 7+ with same constraints
Xcode:
Build:
So this is the answer as it's only affecting me currently. It's been escalated to Code-Level Support, They are sending someone to the team to investigate my mac as even when reinstalling Xcode it should not have or build the problem above. If anyone else is having the trouble above they should use a code-level support request as this is on their end as far as we know about.
As of now my iPhone works on iPad as it should except my problem is that some images partially show as if they got zoomed in on. So I tried turning universal devices on but that's just as bad since everything shifts into different locations.
I am using Auto Layout and this is an old app I'm wanting to update.
Missing constraints was the cause of the problem!
It seems like that missing constraints is the cause of the problem! You might want to redo the layout and constraints.
I have an iOS App that is targeted to iOS 6 and above (I know, I know. But a disturbing number of our users are still on iPhones that have never been updated) and I'm seeing a warning when I compile my app:
Justified or Natural text alignment before iOS 7.0
This is seen for each place I've chosen "natural" text alignment for a control in my xib files. This is confusing to me, because the docs clearly state that NSTextAlignmentNatural is "Available in iOS 6.0 and later."
NSString Documentation
No warnings are presented when I set the alignment in the code, only from the xib.
Unfortunately, I am unable to test this myself because I don't have an iOS 6 device. Is this a warning that I just need to ignore, or could issues still arise in the older devices?
I just made a test project and got the same result with a UILabel set to justified. I repeated with a UITextArea and didn't get the error, so it seems to only relate to setting justified on UILabels.
I ran the same code on an iOS 6 device I have here and didn't get a crash, it just stayed left aligned, so you can probably ignore it, but it is very odd.
Perhaps you could try setting attributed text on the UILabels instead and see if the same thing happens.
UILabel set to Left-justif,like this
setting
I have many layout constraints for a particular app, and in the main.storyboard (preview) the apps look a little bit off, but when I run them in the simulator they look how I want them. So there is disconnect between the two.
I saw the question answered that fixing the constraint warnings would then make the two appear identical.
However, I do not want to try to fix these warnings. A lot of time went into finally figuring how to lay all this out, and I'm worried fixing these (38) constraint errors will screw everything up.
My question is...with the disparity between the preview and the actual device simulation, which one will actually appear if the app is run on a real device? I would assume the one showing in simulation, but I'm really not sure. Is it safe to ignore the errors and the strange main.storyboard (preview) layout it shows me and go with the simulation? It looks how I want it for each simulated device, so I'm weary of changing anything now. Thank you!
According to my experience, Xcode has some problems in storyboard. If you have a constraint which makes a view becomes visually invisible, you will get a warning about this constraint. You can quickly fix it by clicking the warning icon BUT if you close you project and reopen it again, the warning will be there.
The final result should be the UI shown in simulator instead of interface builder or storyboard.
I am creating this screen:
But when I run things, I get it to look like this.
If you notice, the space below/above some elements looks off. Would anyone know why thing happens and how to fix this?
Thank you!
If you're asking about why the buttons look the way they do, that is because your storyboard is set to be viewed as "iOS 6.1 and Earlier", so you're seeing the interface elements as the appear under iOS 6.1 -. Then when you run the application on your iOS 7 simulator, these same elements appear as they do in iOS 7 +, which you can see is quite different.
Then as far as the alignment problems go, I suggest you read through the 80 iPad storyboard related warnings that Xcode is generating and fix your constraints.