Moving tableview into existing window in Interface Builder - iphone

In Interface Builder, I dragged a UITableViewController object from the library into the project. Then, a tableview popped up. How do I get that tableview inside my already existing window?
Thanks, I'm totally lost!

That tableview is part of the UITableViewController, and is connected to its view property. The second window pops up so you can set that UITableView's properties directly.
If you're just starting out, I'd suggest checking out a few tutorial. The site I started learning from is called http://icodeblog.com/, and I'd also recommend the Beginning iPhone Development book by Jeff LaMarche and Dave Mark. Also, if you have iTunes, the Stanford iTunes class is a terrific way to learn in-depth about iPhone development, and it is free to download from iTunesU.

If you have created a view based application, the thing that you need is to add a uitableview from the library to the view. Be sure that you add uitableview, not its controller. It will be seen under dataviews

You have to take UIViewController first and bind it with view. Then add UITableView in your controller and bind it with IBOutlet object of UITableView.
Then you have to set datasource and delegate of UITableView. That's all. Now you can access all the methods of UITableVIew inside your controller.
If you still find any problem then please let me know. I will definitely help you out to solve this problem.

Related

The best implementation of a tableview in Model View Controller

What is the best implementation of a tableview in Model View Controller?
I'm developing my app without storyboard, all programmatically .
Is it possible to implement a TableView in a UIView? I tried it, but If I implement the TableView in a view, when the controller recives a button action, I can't modify or access to the tableView of the View...
After that, I tried to implement the tableView in a ViewController and it works perfectly, but I don't know if this is a good implementation because I found the same problem when I wanted to implement a TextView/TextField with a Piker, for example.
My goal was to had a clean code of viewController with a views and controllers (of buttons etc) and now I find myself with a uiviewController with the view and multiples components when I wanted the components were in the corresponding views.
Thank you very much!
It is all possible, and the problems you are running into are not because of it being something that you should not do, but that it is something that inherently works slightly differently than before. To answer your question directly, I would implement the tableView as the modal view controller directly, either as a UITableViewController or a UIViewController that inherits the table views delegate and datasource (this method being chosen if you don't want the table view to use up the entirety of the modal view controller's space).
TableViews are simple to use, but understanding every detail of how they work will make you far stronger and able to use them in any of these scenarios. I am not going to write you a guide on their use, butcontinue studying them before you declare that anything "can not be done".
Knowing what classes to implement the delegate methods becomes very important during these different scenarios. It is often easiest to use textfields delegate's implementation in UITableViewCell's subclass rather than in the UIViewController they are in. This allows for a more modular creation.
I find that working with the storyboard allows for a much quicker learning curve, and also a time saver. The one excuse I will give you for working without a storyboard is if you have an extremely slow computer.

Add SDNestedTable to a subview

Hello there fellow programmers,
I am wondering how to add the SDNestedTable into a project of mine.
Here is the source code for the SDNestedTable:
https://github.com/serverdensity/ios-SDNestedTable
I would like to add this table to a subview of one of my XIB's in my project.
Thanks, hopefully someone can help me out! :)
If you add a UITableView to your XIB file, then click on the second tab (right side panel) and in that make the class the SDNestedTable rather than your UITableView so it makes it that class instead, assuming also that SDNestedTable is a subclass of UITableViewController.
You should be able to then add your property to your .h file and attach it in your XIB:
#property(nonatomic, weak)IBOutlet SDNestedTable *nestedTable;
and in your .m file will go all the delegate methods you need that are also listed at the bottom of the github link you've provided, similarly to a UITableView and the dataSource and delegate methods they have I would imagine.
There are three problems (based upon the review of your actual source code that you posted in your other question):
You need to make sure you include the NIBs and PNG files in your "Copy Bundle Resources";
If you are going to support iOS 6, there is a bug in SDNestedTable and you have to change the cellIndexPath of SDGroupCell from assign to retain;
If you're adding the SDNestedTable (with its own controller) as a subview of SDNestedTableController as a subview, then you should use view controller containment.
All of this is explained in greater detail in my other answer to this question:
Works on iOS Simulator but not on iPhone

Pull to refresh - Solution found but unable to implement it

I am using the example shown in the Pulltorefresh library. They have implemented it to fit a TableViewController class. But mine is a UIViewController, and i am adding a TableView in it.
I found a SO answer that shows a workaround for this. Can someone tell me how to implement it as described in the SO answer. Here's the link for the answer
That answer is not talking about using the library you are referencing. They are talking about how you would go about creating a UIScrollView with the "pull to refresh" functionality.
It shouldn't be that hard to transition the code to a UIViewController. Just change the code to subclass UIViewController and setup a UITableView property on the view controller (and make sure to set the data source & delegate of the UITableView to the view controller). There might be more to it but these are the basics. If you ask a more specific question about how to transition it to a UIViewController then maybe I (or someone else) can help more.
maybe you could try a different library?
I've used this one in the past, and it worked great!
http://cocoacontrols.com/platforms/ios/controls/egotableviewpullrefresh
Edit:
Here is the exact tutorial I used. He does exactly what you want. Adds the pull to refresh to a UITableView that is contained in a UIViewController!

creating a Table View in Xcode 4

I'm new to Xcode 4, and having some problems with TableView.
I have a ViewController which I dragged into a TableView.
I have the source model, and created an array,
but I don't know how to get the TableView to display the values.
I don't want to use a TableViewController, because I want the table to be smaller than the IPhone screen - but without it I don't know how to connect the TableView to a controller.
can someone provide me a good step-by-step explanation of how to do it?
thanks
A simple and efficient example of creating a TableView , here
declare your view controller as conforming to the UITableView delegate and datasource protocols
Connect the tableview's delegate and datasource outlets to your view controller in interface builder
implement the methods as described in the documentation.
Table view controllers give you a little extra in terms of editing mode and a few visual features on the table, but you can add a table view to a view managed by a standard view controller and be just fine.
If i understoof the question correctly to connect the smaller table to the code, you right click on the table in the interface builder and connect the delegate to the files owner it should work.
Otherwise if you check out http://www.geekylemon.com they have some really good tutorials
Cheers

Problems converting UITableViewController to plain UIViewController

I"m having some issues trying to manually convert a UITableViewController to a plain UIViewController. I need to change some of the layout of the view, so I'm just planning on creating a UITableView manually and positioning it on the screen myself.
I deleted the automated xib file that was generated by default from the project creation process. I changed the view controller to subclass UIViewController instead of UITableViewController as well and have it set adhere to the UITableViewDataSource and UITableViewDelegate protocols.
I also set a UITableview *tableView property & synthesizer, but I did not manually alloc or addSubview with it.
However, when I launch the app and the view loads, the tableView still shows on the screen. I just don't understand how this is happening.
There has to be some kind of vestigal code that was created automatically that I'm not finding and need to clear out, but I've looked through all the related files (app delegate, view controllers, xibs, etc...) and I can't seem to find anything.
You need to make some changes in nib file also. Try changing nib files connection.