Can't even get a UITableView to show - ios

I'm starting to learn to program and I'm already getting a really annoying problem. When I follow, step by step, the Apple Developer guide "Start Developing iOS Apps Today" and I add a UITableViewController (even if it's the only view controller in the project) and I set it as the initial ViewController, I run the app to check if it works and I can't get the table view to show, all I see is a blank static background.
It doesn't matter what kind of cell I use, the table view doesn't appear.
What am I doing wrong?
Xcode 5.1, target: iOS 7.1

How to get UItableView to show
Drag a UITableViewController to the storyboard
Give your prototype cell an Identifier (e.g "cell")
Create a Objective-C class file that inherits from the UITableViewController Class.
Assign that class to the ViewController you dragged
Return at least one section
Return at least one row per section
Set a text for the cell in cellAtRowIndex
I created a DEMO PROJECT for you, see how I did things over there.

You can't show a blank table, you need content to show to be able to see your table.

Related

Table View not showing up as expected

I'm pretty new to Xcode and I'm learning. I'm trying to make a test app. I can't get it to show up in the app like I set it in my storyboard?
Add a UITableViewController and assign it to your tableView. And FYI in Xcode you design one cell only if you are using dynamic cells and the population of the cells will all happen inside your UITableViewController (hence the name PrototypeCell)

Cell content of a Table View that is part of UISplitView is not being rendered

Here is some background to the issue. I've been looking at it for the past two days and to my knowledge everything is properly configured. To make sure that we are on the same page with versions that are being used I am using the following:
Xcode 6.1
Code is in Swift with some added Objective-C libraries
OS X is 10.9.5
I have UISplitView that was added to the storyboard at a later stage of the project. The project was started form Single View template. Normally the left part consist of a UITableView. When Xcode added it to my storyboard it also had a prototype cell setup. I've added the needed Identifiers and now the prototype cell is accessible in my code. I've implemented and binded the needed delegate and dataSource protocols and checked that their methods are actually being called and working. I've also added background colors to the prototype cell and the prototype label and I see a cell when there should be one but it does not have a label. So here is a list what I've checked:
Data binding is working and data is available. I've also cross checked this with a second UITableView that is in the project and is working properly. This is also true because I see the background color that was set for the cell when I run the app and data is available;
The storyboard does not have any errors or warnings. In fact the project itself does not have any warnings on compilation;
I've reset/removed/recreated constraints multiple times;
I've used the Preview mode and I can see the label rendered properly on my target device and orientation. I've checked this because storyboard sizing can be easily overseen so that you actually don't have the label for this device and orientation but this is not the case;
I've used the new layout debug feature that Apple added in Xcode 6 called view debugger and it does not show a label for this cell. And on the following screen shot you can see that the background of the cell has been properly rendered but there is nothing that is on top of this cell. The cell has been selected for better clarity.
So pretty much I am out of ideas right now. Can you please help me on revealing this mystery?
To answer my own question.
I've created an empty master detail project and saw that this is working there. This made me think that actually there is some kind of a bug in Xcode when you drag and drop an UISplitViewController to your storyboard. For some reason the storyboard is not properly configured. I have no idea what is not properly configured but there is definitely something that is wrong.
Because of the above observations I deleted the UISPlitViewController and used a plain UIViewController to recreate a similar setup that will also work for me. As a result I was able to adjust my already existing code to the new View and use it without logic changes. Which to me just indicates that this is an Xcode issue.
Thanks!

UISearchBar appearing at *bottom* of UITableView

Hope someone knows what to do, this is driving me nuts !
I've got a very simple UITableViewController, in an existing application, to which I have added a UISearchBar using interface builder (drag n drop)
Note: This problem exists when testing in either iOS 6 or iOS 7
My problem is that when the application is run, the searchbar is displayed at the BOTTOM of the results
When I click into the search area to perform a search, the searchbar then flicks to the top of the page
At first I thought "this is me", so I deleted the controller completely, including all code, and rebuilt from scratch the page in order to avoid any mistake I may have made. Unfortunately with the same result
The structure in IB is :
The controller code just does bare basic at the minute, just cellForRowAtIndexPath
Just add a prototype cell and put the search bar on top. You don't have to ever use the prototype cell.

Unable to use Static Cells in UITableViewController

I need to use static cells in my app. I am using Xcode 5 and testing thins on iOS 7 simulator (iPad).
I dragged out a new UITableViewController in storyboard and set the tableview's cells to be static. Then I added a Label to the first cell to check if static cells are working. I ran the app and I got blank cells (dynamic form).
Then I added a class that implements the datasource and delegate methods of a table and attached it to the controller in storyboard. Yet, nothing happened. Finally, I embedded it in a UINavigationController and still, I get plain blank cells like the one below:
Could you tell me whats going wrong here, i.e., why wont my static cells show up!?
Regards
if you use static cells you dont need the datasource. so delete all methods that belongs to datasource, such as cellForRowAtIndexPath. After deleting the methods your label should appear.

Custom UITableViewCell class in Xcode 4.2

I've been following this Apple Doc to add a custom UITableViewCell that I layed out in an .xib to my project. One problem with the doc is that it seems like it was written for an older version of Xcode.
I'm able to load my UITableViewController that the custom cells are on, but the cells are all blank. My custom cell contains several UILabels, and has a non-default background color. The table that appears when I run has the default white background and no labels. If I change the UITableView's View -> Background on my storyboard, the color of the cells' background changes, but the labels still don't appear.
Of interest is the fact that the data is still in my table's cells. The UITableViewController is itself called as a popover from another controller. When I select one of the cells, the strings from the various label.texts are supposed to be loaded into their own labels on the popover's delegate, and that code works fine (except when I try to include a UINavigationBar in my popover, but that's probably another issue entirely).
I'm still pretty new to iOS developement, so if there's anything I'm leaving out or being unclear about let me know.
Edit - cleaned up code, now is completely different question than when I originally posted, but is still on the same topic. Should I have deleted the old question and posted this as a new question all together, or is it alright that I just edited it?
I'm still not entirely sure what was wrong with what I was doing before, but I managed to get what I wanted. I originally dropped a UITableViewController onto my storyboard set up a popover segue (also on the storyboard) and tried to display the popover with performSegueWithIdentifier. Instead, I now create the popover completely in my code (which I found a nice tutorial for here on SO, by goggling "show popover programmaticly"), without having anything for it on my storyboard. That seems to be the most documented and stable way to show a popover. Once I displayed it that way, my custom cells showed up exactly like I wanted.

Resources