All of my objects disappear in my iOS simulator, why is that? - ios

I'm currently working with one navigation controller, and 3 view controllers. when i run my program, everything runs smooth, but none of my objects on my second and third view controller appear in the simulator ( labels, buttons, text fields etc.), how ever the navigation bar is there. why is that? how do i fix it?

For me, the issue was that I had added the button to the LaunchScreen.storyboard, instead of the Main.storyboard.
Credit to this post: http://discourse.djp3.net/t/first-ios-app-button-and-label-disappear-in-simulator/104/13?u=drazisil

Apparently it was an auto layout error. I removed auto layout and disabled size classes from my project and the simulator showed every object within the interface. I then enabled both auto layout and size classes once again & manually added my constraints instead of allowing Xcode to do it for me. Worked out fine once i ran the simulator again. I think this is a bug in Xcode's iOS sim.

Related

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.

xcode 6.2. view controllers greyed out, locked

I have a xcode project with buttons and other objects in it. But the objects are all greyed out in my view now. The project still compiles and shows the buttons fine. I saw posts about using auto-layout, changing size-classes, and modifying the IB. But whenever I make any of those changes, a lock icon shows on the screen and nothing changes. I can go back to an old version of my code, but I'd rather find out what will fix the issue.
What was I doing to break it? I was just exploring through the different xcode windows and views, and don't know exactly when the viewcontroller objects became affected.

Weird space in iOS7

I just ran a demo app on iOS 7 target, this is what I get:
I'm using a storyboard and it looks well in iOS8. Constraints are correct.
I already checked e.g.
UITableView is starting with an offset in iOS 7
but the issue in this case is the whole thing, incl. status bar has the offset, no idea what this is. I played around with the layout settings of the view controller in the storyboard without any effect.
I also created a brand new (single view) project, ran it without changing anything, got the same issue. Don't know what can go wrong in a new project concerning autolayout as I can't set any constraints in the root view controller's view...
Any ideas?
Thanks in advance.
Try adding a "Default-568h#2x.png" launch screen to keep your iOS 7 device from running the app in Letterbox mode.
What Apple really wants you to do is use Auto-layout (see point 1 in the linked blog), which is what I suspect your demo app isn't doing.

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.

UI in Interface Builder doesn't match UI on a device

I am totally new to iOS development. Just starting working in Xcode 4. I build UI using IB, but when running it on simulator or an actual device UI is rendered differently (I get overlapping buttons on the device or simulator, although everything is displayed correctly in IB). None of the controls were created with code. Everything was done in IB. I copied some buttons in IB as they are performing the same logic and hooked up to the same IBAction. I checked view hierarchy - everything looks right.
Any idea what might be causing it?
Thanks.
Take a look to the option of your xib's simulated metrics.Check attached screen shot.

Resources