Why can't I drag a UIView into my UIViewController in Interface Builder? - interface-builder

I have a UIViewController subclass. It currently has a UITableView in it.
I want the UITableView to be a subview of a UIView, so I can find the bottom of the screen and put an ad banner there.
When I drag a UIView onto the UIViewController, it won't go there. I can drop it in as a subview of the TableView, but that's not what I want. I can also get the UIView to drop in beside the FirstResponder and Exit, which doesn't seem right.
Screenshot shows the hierarchy in Interface Builder, and the definition of the UIViewController so you can see it's not a UITableViewController subclass.

Related

Multiple UIViewControllers in a tvOS Storyboard Scene

I'm trying to create a storyboard scene for tvOS where a UIViewController has an embedded UITableViewController. I'm unable to make the connection, though, and I'm not sure if I'm doing something wrong.
At present, I have a UIViewController scene, and a separate UITableViewController scene. The UIViewController scene has a UITableView within it. When I try to make an "embed" connection from the UIViewController to the UITableViewController, I can't select anything else in the Document Outline. I tried adding another UITableViewController to the main scene's dock, and it will only let me drop it onto the canvas, not as a part of the main scene.
I haven't done this with iOS yet, so I'm not sure if what I'm trying is supposed to work, and it's a bug I need to report, or if I'm taking the wrong approach.
Embed segues can't be created from a "normal" UIView, you need to set it from a ContainerView class that you need to drop into your UIViewController.

Xcode Storyboard Scrolling

is there a simple way in xcode storyboard to create a scrolling page including both text and images? Also, is this possible without using code? (Code is fine, but preferably none)
It's very simple but kind of impossible without coding although the code is very simple, just copy and paste this and you should be away.
This is for your ViewController .h
#interface ViewController : UIViewController
{
IBOutlet UIScrollView *Scroller;
}
This is for your ViewController .m under the super viewdidload
[Scroller setScrollEnabled:YES];
[Scroller setContentSize:CGSizeMake(320, 1000)];
Now all you need to do is add your UIScrollView onto your storyboard, in the view Controller scene click view controller, then just look in your outlets and connect them together by dragging from the word Scroller onto your UISCrollview

Can't CTRL+Drag NSButton to custom NSView header

I'd like to create a custom NSTableCellView instantiated by Interface Builder. I've set my Table Cell View class to MyTableCellView, and properly created MyTableCellView : NSTableCellView .m/.h files.
However, I just can't CTRL+Drag a simple button from inside this view to MyTableCellView.h in order to create an IBOutlet.
Here is a video to show what happens: http://youtu.be/sNNbuVT-SZs.
How the view is subclassed:
How I try to CTRL+Drag a button
Also, sometimes, Interface Builder just don't allow the cell view's class to be modified. What's happening ?
I finally found a solution, that is a little weird but works as expected. Instead of connecting the NSButton to MyTableCellView header directly, I used the reversed path:
Manually create an outlet:
#property(retain, nonatomic) IBOutlet NSButton* button;
Then click the empty circle on the left, and drag it to your XIB file's button:
I have no idea why it works this way, please let me know if you know the anwser.

Switching To the DetailView of a NavigationController?

How can I get to the DetailView inside a NavigationController. The Navigation Controller is inside a TabBarController. I managed to display it, but then the NavigationBar and the TabBar disappear.
Screenshot
http://i.stack.imgur.com/d0GN5.png
You have one the following options:
Change the FirstViewController from UIViewController to UINavigationController and push DetailView into it.
Present DetailView as modalView
Programmatically, add view of DetailView to FirstViewController as subview
Hope it helps.

point of UIViewController in IB

What exactly is the point of adding a UIViewController in IB? There is no way to add code like you can if you create a viewController in Xcode? And if you can what is the advantage of doing it in IB.
And isn't the whole point of a MVC to seperate code into "modular" parts so why would add a ViewController in IB
Sometimes all you need is a UIViewController. But most times you would create a UIViewController subclass of your own (in IB).

Resources