Xcode, Button not showing on UITableView (Basic level) - ios

I'm having a problem performing a basic action in xcode. I want to add a button to a TableViewCell using the storyboard. I'm able to add it: drag and drop from the palette. But it is supposed to be shown when I run the app right? isn't it? I see the TableView, I see a label I've putted in the cell but I don't see the button. That's very annoying.
This is how it looks in the storyboard:

Have you tapped the "Debug view hierachy" button to see whats going on in the view. The button shows at the bottom when you have an app running in debug.

This ViewController's size probably does not match the simulator's or your device's size. That is why the button does not appear.
Make sure to either add constraints when using AutoLayout or setting the button's position in code.
Hope that helps :)

Related

How to set iOS ScrollView in DetailViewControl?

You need a scroll view to implement it as shown in the picture above. But I don't know how to implement it. That's the only thing on the storyboard that's missing.
And when you run it, you just move the scroll bar next to the screen, and there's no change on the screen.
Do you have any suggestions?
Have you tried to deselect Content Layout Guides?

How to display UIView that's outside of screen in main.storyboard?

I'm working on a screen that has a UITableView below the screen(thus invisible) initially, but will pop up when user click on a button. I know it's not supposed to be seen on the screen, but just for the sake of design, is there a way to make it visible when I'm working on main.storyboard?
Please see the picture attached below. It's really hard to work on the UITableView when it's beneath the toolbar. How can I force xcode to display them so it's much easier to work on?
You can't, but you have 3 workarounds:
Move it into view (Xcode will complain that it's not in the right position, but it doesn't matter)
On the bottom left on your storyboard, you can open up the view hierarchy, you can find your element there for creating constraints, linking it with your code and everything else you'd want to do.
Increase the visible size of the viewcontroller on your storyboard, trough selecting your viewcontroller on the storyboard, changing Simulated Size to freeform and increasing the values (will not affect size when running).
The easiest way to deal with this is to:
open storyboard
select the viewcontroller you want to edit
open the Size Inspector
Switch from Fixed to Freeform
Type in a larger height (like 1000)
Simplest thing is to manually do what your button does in the app.
In the view hierarchy on the left, select your table view and move it down to the bottom. This will bring it to the front in interface builder.
When you are done, move it back.
I do this all the time and you get used to doing it. Just watch out for accidentally moving it inside another view when you drag it down or up.

Xcode 6, Interface Builder size issues

I am trying to put a textView inside of a tableViewCell and I am currently using autolayout. I do not understand why my textView is behaving badly (see screenshot below). I don't understand what to add in order to make the preview to display what I have in IB. Here is a screenshot...
Thank you for any help! I am new to Xcode 6. Thanks for any help!!
You didn't add constraints of textView, try to select the textView, in storyboard click the second button on bottom bar and add new constraints to its superview which is cell's contentView.
This is a bug in Xcode 6 at the moment. I have reported it to them.
In the mean time you need to go to that little box down the bottom left of the Storyboard screen (show document outline) and select it. Select your view from in there and select your UITextView. Then resize or do what you need to that way.
Warning
Resizing the UITableviewCell by dragging it and not using the Size Inspector may resize your textview to 0 so you may have to repeat the process.

Placing a control over a mapview iOS 7 using storyboards

I'm trying to place a button over a mapview. In storyboard I have it as the last control in the view hierarchy, the map view still covers it up. I've tried adding this line in my viewDidLoad method to bring my button view to the front but it doesnt seem to work either
[self.view bringSubviewToFront:self.flagButton];
anyone have any idea why this wouldnt be working? the map view covers most of the screen, and I want to place a few buttons on top of the map, but so far can't get them to show up, they are under it every time.
I was able to do this by making my view as subview of map view.
first,
self.view = self.gmsMapView;
then,
[self.gmsMapView addSubview:_myBtnView];
I know this is an old post, but I'm answering for the sake of someone facing the same problem.
I was having the same issue, then I found a solution, and is as follows:
First, open your project and go to your StoryBoard then click on "Show Document Outline" switch that is on bottom left very small switch. After that select your "Scene" that you are having problems with then click "View". Find your MKMapView object and drag it up until you reach the first row. This will make your MKMapView object (or any other) "the first in a layer" so to speak.
I hope someone will find this helpful.
E
I was using storyboards and was not seeing the button. I had to set the MKMapView to hidden until the button was displayed and in position. Then I set the MKMapView to visible.
Here are the steps I had to take in the interface builder to get my button to show
Create a UIViewController which contains a view
Add an MKMapView and set constraints
Add UIButton in the same view as the MKMapView, set the image and text, whatever is applicable. If MKMapView disappear when you try to resize or move the button, the map view has just set its width and height to zero. Enter new values in the Size Inspector for the map view and it will resize back. Or you can move the button elsewhere off the MKMapView and then move the button back to where you want it.
The important part is to set constraints for the UIButton. I also had to set the MKMapView hidden until I got the size and placement right and then set it back to visible.
Here's how it looks in the simulator
You can't add a subview to an MKMapView via the storyboard. Add it as a sibling view instead.
Edit: Your map view should also be a subview of the root view (i.e. self.view) for this to work.
I was having similar issues and I did the following:
Made sure both the map view and the button are at the same level in the view hierarchy, I accomplished this by creating a View that both the map view and button were children of.
Made sure the button is dragged below the map view in the left gutter of the storyboard (so it is actually rendered on top).
Made sure there were valid constraints for the button.
The only thing new that hasn't already been mentioned was double-checking the constraints, and that appeared to resolve it for me. Hope that helps.

Storyboard UIView cuts off objects when scrolling

Using Storyboards, I have a scrollview with a UIView embeded into it. On that UIView I have some text and a button. The button is down a bit, for this question.
When I scroll in the simulator and on the device, the UIView gets cut off where the button is. (button there to show the cut off)
Above pic is before scrolling.
This pic is showing the scroll UIView and the button embeded into it being cut off.
I have set the Size Inspector to 1000 height.
I have searched on stackoverflow and I have not found an answer as of yet.
Thanks for any help.
It looks like the hierarchy of this particular window is not ordered properly. You need to rearrange your hierarchy. To do this, go to your storyboard, and click on the little button on the bottom left that looks like the play button with a box around it. From there, you can adjust.
I had the same issue in an app i was working on. For some reason, it didn't work for me either. I suggest you try creating the the scrollview and the view inside it programatically instead of storyboard for this particular view controller. It will work like a charm. You will also have to find the length of the inner view and then set the size of the scroll view to the size of the view embedded in it.
I figured it out. Not sure if this is the preferred method or just a work around.
The main difference is I connected the last ScrollView, not the First one. Not sure why but it works.
Before, (pics above in original post with cut off button), it would cut off my UIView. I still would like to know "why" it does this. Thanks for the reply's.

Resources