View Container not showing table view control ios - ios

I'm trying to embed a table view control inside a container here's my app:
when i set the table view control class to UITableViewController every thing works fine:
it shows the controller inside the container.
But now i want to put some code behind the table view controller so i add a class (h,m files)
and set the class of the UITableViewController to be TableController (thats my class name)
when i load the app now, it doesnt show the controller.
looking for some explanations or solutions to this problem.
thanks.

You can simply create a View controller class instead of creating a tableviewcontroller class . In its xib , add a tablview. Set table's delegates and data source , and start working on it .

Related

(Xcode 7.3.1) Not able to connect subview controllers to view controller.swift

I am trying to make a card game with multiple view controllers. I have created my application in a single view application, and have been trying to use multiple view controllers. When attempting to drag the images/buttons into the view controller code, it will not accept it unless it comes from the main view controller. I have posted screenshots that show my problem
You have to make separate class for for every view controller and you have to assign that class to respective view controller from identity inspector from utilities.
Check the screenshot,
So here setting view controller is class , subclass of viewcontroller. So, create subclass of viewcontroller, then select respective viewcontroller from interface builder and assign that class to that view controller and then open that class in assistant editor and you will be able to connect outlets or ibactions.

Can not drag and drop UITableViewController into Storyboard

A book I am using is telling me to drag and drop UITableViewController in object library into Main.storyboard, but it's not working. The UITableViewController just rushes back to object library. What's the problem? It works fine with "Table View". I am using Xcode 7.2, and OS X El Capitan.
Please help.
If you can't drag a Table View Controller to IB, then don't do it. Use a Table View instead! They are (mostly) the same.
I guess your book is telling you how to create a simple table view. So let me tell you how to create a simple table view in a view controller.
Of course, you should first drag a view controller to IB. Then add a table view to the view controller. Add the constraints if you want. Then run the app!
You will probably see a few horizontal lines on the screen and you can scroll it. How nice!
Now how do you add contents to the table? Just create a view controller class file and associate it with the view controller you just created. Then make that class conforms to the UITableViewDataSource protocol and add the required methods. Finally, just associate the class with the table view's data source property. I think your book will talk about this in detail.
If you want to know more, visit https://www.youtube.com/watch?v=s78ndDj8K3U&list=PL6gx4Cwl9DGDgp7nGSUnnXihbTLFZJ79B&index=21
You can't drop a view controller on top of another view controller.
(This is why you are able to drop a Table View onto a view controller, but not drop a Table View Controller.)
Instead, drag the Table View Controller to a blank area of the storyboard. It will be droppable, and appear on the storyboard.
Note that Interface Builder changes the appearance of the droppable object to include a + sign when it's over an area where it can be dropped (and added to the storyboard).

Interface Builder : cannot assign custom class to table view controller

I am trying to create a simple app for iOS that uses a tab bar controller to present either a map view or a table view. Both the map view and the table view have the same navigation bar button items:
A Logout button on the left, and Refresh, Add New buttons on the right side of the navigation bar. So I have started experimenting the idea of having a parent controller called LocationViewController, which inherits from the UIViewController.
For the table view, I have a controller called TableViewController: LocationViewController, and another controller called MapViewController: LocationViewController.
On the storyboard, I added a set of two buttons (for refresh and add new) to the top header section of each view (very small, may be hard to see). See the image attached below:
There is no problem for me to assign the custom view controller MapViewController to my map view panel, but I cannot find the custom controller class TableViewController in the panel (see the below screenshot)
I found a similar post on stackoverflow, and a reboot solved that problem, which I also tried, but did not solve my problem at all.
You have added youe buttons in the wrong place. I do not know the right name for the bar, but it contains "associated objects". What you want to achieve should look something like this :
Unfortunatelly, you cannot add two UIBarButtonItems to one side of navigation bar via interface builder. You can either drag a UIView instead of UIBarButtonItem to that "slot" and add two UIButtons there, or you ca add multiple buttons from code.
Also, it seems that the name of your question is a bit misleading :) After carefull reread of your post I found the "right" question.
Answer - you have added a UITableViewController in your storyboard, but your class doesn't inherit from UITableViewController. If you want to keep the base class, you will have to make it a "plain" UIViewController and add a UITableView to it. Note, that this way you won't be able to have prototype cells.
You may need to subclass it from UITableViewController. Replace the UIViewController parent class for UITableViewController, like this:
class ViewController: UITableViewController {
Then make sure you selected the View Controller where blue color is all around it and then you can place the name of the class that inherits from UITableViewController.

UITableView Troubles

I have created 3 tableview controllers from scratch on the main stroyboard in Xcode. I have desgined the rows etc.
Now when I create files, File-New to create the .h and .m files (Subclass UITableViewController), then I add the file as the Custom Class in the UITableView , the tableview does not show.
If I set the Custom Class as blank (default UITableViewController) it works fine.
Any ideas why it is blank and only the NAV bar is shown when I add the custom class to the table view controller.
thanks

Embed Segue with Custom Class

Hi i'm pretty new to IOS app development and I have somewhat of a problem. I created a view controller and I have a table view controller embed as a segue inside a container on the view controller.
By default the table view controller shows when I test the app. However when I add a custom class for the table view controller it does not show in the container.
What am I missing?
just follow this tutorial http://www.raywenderlich.com/5138/beginning-storyboards-in-ios-5-part-1 and http://www.raywenderlich.com/5191/beginning-storyboards-in-ios-5-part-2
and try to post some screenshots or code for better understation of you question
Got it figured out. Had to comment out the methods in the tableview sub class for data source.

Resources