UIStepper Not Visible - ios

Via storyboard in XCode 5.0.1, I've added a simple UIStepper in my ViewController. However, I've noticed that when I place it up towards the top of my screen where I need it it doesn't actually appear in the simulator nor on the device. I thought I was going crazy so I created a test app outside of my regular working project to prove I wasn't--as it turns out, I'm not. I placed it in a simple view and noticed the bottom edge of it up at the very top of the view. (I wasn't seeing it at all in my original project because I had a nav-bar at the top.)
The following images show it as it appears in the storyboard (UIStepper visible) and on the simulator/device:
(Storyboard)
(Simulator)
Two questions: Is this a bug? Other than guessing where it should appear and setting its frame origin manually what would be the recommended approach to ensuring my UIStepper shows up as I've placed it in the storyboard? (I'm afraid manually setting the frame origin would break or mis-align in future iOS versions.)

Related

IOS DEV: Should I be concerned if the Main.storyboard layout looks different from the actual layout?

So for my app, the tableview layout in the iOS simulator when I click run is CORRECT and as I intend. However the layout is not always 100% the same when I view the layout of the tableview in Main.storyboard. When I refresh Xcode(i.e. quit and restart app), the layout of Main.storyboard is what I intend. However, if I play around with orientations/diff iOS devices within Main.storyboard, and then return to my original device, the layout looks incorrect (even though supposedly the math/measurements are correct). Do I need to be concerned?
For reference I followed the instructions of https://www.ralfebert.de/ios-examples/uikit/uitableviewcontroller/custom-cells/ EXACTLY to make a cell (instead of an image, I used a button though). And here is an image of my iPad simulator https://drive.google.com/file/d/152scJF6h12amh-AAycDqpe6TXOzN2y-H/view?usp=sharing vs the main.storyboard simulator https://drive.google.com/file/d/1NvUfMVLk08S8qH4mFraRsQYbDzPdjaBG/view?usp=sharing
However the layout is not always 100% the same when I view the layout of the tableview in Main.storyboard.
It sounds like you might have some missing or incorrect constraints. Take a look at the little yellow arrow icon to the right of "View Controller Scene":
That icon tells you that there are some issues that you need to resolve. Click it and you'll get a list of the particular issues and your options for fixing them.
Do I need to be concerned?
The risk, of course, is that under some circumstances your view won't draw the way you want it to. Start by fixing the issues that Xcode is pointing out, and then test on lots of different devices (or simulators) as you can, in all the possible geometries you might encounter (different screen sizes, orientations, split view, etc.).

Horizontal slider disappears when using constraints in Xcode Swift 3

I have a horizontal slider that appears and works fine. But when I add any constraint, it disappears from the build. I've also done an archive and tried it on my real iPhone 5c device.
Any ideas what could be causing this and how to fix it?
Screen in Xcode, showing constraints:
Screen in preview (same on real device), and it does not appear:
It looks like you haven't set the y position of the slider view. You need to hook that up too, that should fix it.
On the left side of the storyboard, there is the overview of your ViewControllers. In the upper right hand corner of the one, you're currently in, there should be a tiny warning symbol:
If you click on it, you will be presented with what might be the issue:

Why is my App always shifted to the right in the iOS Simulator?

I am building a simple iOS app using Storyboards. Currently running Xcode 7.2.1. I have previously built one using .XIB files and never had an issue with layouts on devices.
I have a UIViewController that has a UINavigationBar and Bar Button Item. When I run the app in the simulator, everything looks shifted to the right and partly off screen. The title should be shown in the centre. I am simulating using iPhone 6 and everything in Simulated Metrics are set to Inferred. Could someone help me understand, am I missing a step?
The views are shifted because you didn't set the auto layout constraints. To fix this, add missing constraints.

Why is iOS simulator displaying blank screen when I rotate device?

Getting through some introductory swift and playing with Xcode and I basically just have a page with some color squares, background color etc. Doesn't do anything. Problem is when I compile the code it will run in simulator just fine and show everything perfect, BUT when I rotate the device, everything disappears and it only gives me a blank white screen. Rotating right or left does it. The only view that shows it is the original upright view (for all iPhone devices that I tested on through the simulator).
Xcode 6.1.1 and iOS Simulator 8.1 are being used on my MacBook Air with OSX 10.9.5.
In the App general page, I have already checked under Deployment info that Landscape Right and Left are both checked on. Storyboard is set on Any H and Any W.
I'm not sure what I'm doing wrong and it has been pretty difficult searching since I'm still new to iOS development I'm not sure I'm using the right words or whatever because I can't find an answer.
Summary:
App displays properly in iOS Simulator, Portrait View but no other views work and will display blank white screen instead.
In order to see if your views are actually being drawn and just off screen as others have suggested capture the view hierarchy. Go to 'debug' in the menu, then in 'view debugging' click capture view hierarchy. This will pause your app and create a 3D representation of all view on your screen which you can move around by clicking and dragging.
Are your views actually being drawn? If yes are they drawing off screen? If yes then you need to fix your constraints.
It sounds like you haven't set your constraints appropriately. Try setting the top and leading constraints for each of your views to something less than 320 (should cover all device sizes). Fix your warnings, then try again. I believe the views are simply off the screen.
You don't have the correct auto-layout UIConstraints set in interface builder. Check the document outline view in interface builder and ensure that you have appropriate constraints set on each view.
Auto Layout issues occur when you create conflicting constraints, when you don’t provide enough constraints, or when the final layout contains a set of constraints that are ambiguous.
Check this Apple documentation out, it will show you step by step how to resolve your (common) issue.

Button is resizing when app is run either in the simulator or on an actual device

So here is my problem:
I am building an iPhone app (not universal) for deployment on iOS 7.0. In my very first View Controller I have two buttons. Both buttons are set as "Custom" and just contain a text png I made in Illustrator as the image for the button. My first button works great. It has both the #2x version and the normal version in the Image.xcassets folder under its own icon name. My next button work exactly the same way, except with different text file. It was created the same way. It looks great inside the storyboard, but when I run my app on either a simulator or an actual device, the 2nd button resizes itself. I have no clue how to fix this.
So far I have tried cleaning the project, restarting Xcode, reinserting the image file, playing with the button properties inside of the storyboard, and turning OFF auto layout.
Here is a screenshot of the simulator running next to the storyboard view in Xcode:
It sounds like the Attributes > View > Mode on the second button may be set differently, but you mentioned you have tried adjusting setting. Try deleting the button that is not working, duplicating the one that is working and changing the image in the duplicate to the second image.
To be sure there is not something unusual going on with your image (can't really imagine what), have you tried using the image that is shrinking in the button that seems to be ok?
You can also click on the "Resolve Auto Layout Issues > Reset to Suggested Constraints" to see if that helps. You can also try clearing all constraints and resetting them via that same menu.

Resources