Shift elements in the iOS simulator - ios

Maybe this is silly question but I can't fix it. In StoryBoard it looks OK
But in simulator it looks:
And no matter how I shifted the TableView up it still looks the same. And it's not just this one time when I put like PickerView in the simulator it looked shifted.
May have some setting in the inspector who is responsible for this, or what is the problem?

Try setting automaticallyAdjustsScrollViewInsets = NO in your UIViewController

Related

Properties assigned to UIButton in ViewController.swift and segue works on Simulator but not on Device

I have an extremely bizarre problem. I created a UIButton and put it on my ViewController storyboard. I added a segue from the Button to another ViewController by pressing control and dragging. I also added an outlet to the corresponding ViewController file and added a border color and width (to the button). The segue and the button border work fine on the simulator but on a device the button border does not show up and the segue does not work.
The only thing I can think of that could be causing the problem is that a little while ago I accidentally deleted my Main.storyboard, so I dragged it from my trash back to my Xcode project. But I am pretty sure my app has worked on the device even after that incident. I wasn't sure if my viewDidLoad method was being fired (since that is where I set my border color and width for the button) so I added a print statement and found out that it was indeed being called. Take a look at the code below...
override func viewDidLoad() {
super.viewDidLoad()
print("Begin Setup Process...")
// Do any additional setup after loading the view.
calibrateButton.layer.borderColor = UIColor.white.cgColor
calibrateButton.layer.borderWidth = 3
}
How would I get this to work on my device as well? What I am doing wrong
Assign Your Border Styling Here...
Try adding the code to change layer properties of calibrateButton in viewDidLayoutSubviews(), i.e.
override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
calibrateButton.layer.borderColor = UIColor.white.cgColor
calibrateButton.layer.borderWidth = 3
}
Also, since you're giving borderColor as white, that might not be visible if the calibrateButton is placed on a white background. Try changing it to something else that is more visible, red for example.
First try in viewDidAppear(), if it works then cut and paste it in viewDidLayoutSubviews().
I finally solved the issue. The problem was that I didn't have a height constraint on my button. I am still not exactly sure why or how this issue occurred. Why couldn I see the button text but not the border? If the segue was not working there must have been a view on top of the button that was preventing it from going off. But anyway adding a height constraint solved the problem. In answering my own question I realize that the title of my question is misleading in relation to the solution of the problem. This problem, in the end had nothing to do with wether the app was running on a simulator or the device. I just assumed it was a device issue since it was working fine on my iPhone XR simulator but not my actual iPhone 6s. However the actual problem was the screen size and how my constraints adapted to it.

Storyboard connected properties not work

Im really confused because my problem may sound silly, i try to explain it clear - when i add anything on storyboard view controller it has no effect. And obvious, my viewController set properly to a controller, that manage storyboard scene. I adding anything - buttons, imageViews, it doesn't appear on a screen at all.
Also i want to add, i never seen such problem before recent Xcode update, when storyboard scene's become "large" and there is single scene for any device (600x600).
That issue literally drive me crazy, i can manage interface objects programmatically but i don't want to, because i use to work with Storyboard. Could you please write some advice or solution?
Thanks!
You need to add positioning constraints. By default, it will leave elements where they are, so they might be cut off. Also make sure what should be in the background is Sent to Back.
You can check if the auto layout this interfirindo or even if you this in the right view.

UITextField not responding to touch in iOS8?

So I have multiple UITextFields in my storyboard, but there is one isolated field that will not respond to any touch (neither in the simulator nor on the device) for all iOS versions, besides on the very right side of the field? This may have something to do with the constraints/frame of the field, but I have tried resolving autolayout issues, but nothing seems to work.
This is what my storyboard looks like (with the malfunctioning UITextField selected):
And this is what the simulator looks like:
Any ideas? There is very little functionality code-wise, so I imagine this is an Xcode formatting thing.
Form the picture it looks like the picker is actual over the textfield. It doesn't look like it but those are rather tall. You could try panning on the text field and see if the picker moves. Also you can try hiding it and see if that changes anything.
Good luck and hope that helps.

Setting Modal Presentation Style causing views to disappear (Xcode 6)

I have set up my view in interface builder. I am using auto layout which has been set up also.
If I present my view with the following code:
GlossaryViewController *glossaryViewController = [[GlossaryViewController alloc] initWithNibName:#"GlossaryViewController" bundle:nil];
glossaryViewController.delegate = self;
glossaryViewController.modalPresentationStyle = UIModalPresentationFullScreen;
[self presentViewController:glossaryViewController animated:YES completion:nil];
Then everything works fine. However if I change modalPresentationStyle to a smaller style such as UIModalPresentationFormSheet then none of my views are visible when the view appears.
I have even tried testing it with just a UIImageView that is set to hug the four edges. Even this disappears.
Before I upgrade to Xcode 6 I had created similar views that still work fine. This has only occurred when creating a new xib.
Has anyone else had similar issues?
After deleting the app, deleting the troublesome nib, doing a clean, restarting xcode and then recreating the xib I still have not be able to get this to work. This was after attempts at changing the size of the view, orientation and playing around with auto layout.
The behaviour is rather odd. Sometimes a single view might show but adding any others by it does nothing.
I have hopefully found a work around for now. If you do as follows:
Click on files owner and then go to the 'Show file inspector' tab.
Next look for 'Interface builder document'. Under this heading is 'Opens in'. Change this from 6 to 5.1.
The following popup appears. (WARNING: if seems once you have clicked 'Disable size classes' there is no going back. So make sure it's what you want to do):
Select the option you want to keep. So if the xib is just for iPhone then select iPhone. This will then give you back the way it was in xcode 5. Basically it's converting it back to a xib that handles either iPhone or iPad and not both.
Look forward to hopefully someone being able to explain what I am doing wrong or if there is some sort of issue with interface builder at this moment in time. Be good use the new interface builder instead of switching back to xcode 5.1 xib interface.

Xcode Interfacebuilder bug?

I got a problem in the Xcode project.
below image shown UITabbar problem. I thought it's a Interface builder bugs.
UITabbar showing a dark color. That only shown a root & one-depth ViewController.
How can I solve it?
Thanks.
== Modified ==
The problem suddenly appeared.
It is not known whether the problem is caused what.
TabbarItem area is like a shown bug as image.
I hope Tabbar area to be displayed correctly.
I tried to various way to solve the problem.
tried ways as a below :
regenerate xcode project and then copy storyboard. => fail
regenerate storyboard and then copy partial elements in storyboard. => fail
regenerate all of them. => I did not try yet.(have too much elements. I want to avoid like this way.)
Interest point is sometimes display correctly. When I first open a simple storyboard file(Default UITabbar Project's main storyboard) like a below image.
it bring to me confused.
I'll summarize what I know about storyboard that may cause similar issue...
Assigning images that have incompatible width:height ratios to tab
bar items
Not assigning any images or not using any system images for tab bar
items
Hope this can help anyone else that has similar issues...

Resources