سؤال

I am using XCode 5, and I am having an issue with assigning class to a TableViewController

I made a form using tableViews within a TableViewController. The TableView has static cells that are the ones containing the textBoxes for user input.

The problem is that after designing the tableView, I added a custom class to it. When I run the program, the view is an empty table view, but in the storyboard looks like I design it.

So maybe after assigning the custom class (which is a new empty class UITableViewController) everything is either not being load or being re-instanced?

Added:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];

    // Configure the cell...

    return cell;
}

This is the default method.

هل كانت مفيدة؟

المحلول 2

None of the above helped me. This is what solved the problem:

What was going on? the problem was that even with Static Cells instead of Prototypes, the TableViews was trying to use his datasource to get the cells to display (The class that i assigned to its controller). It was easy then, i just had to erase the methods in the TableViewController Class.

Maybe because the class had an function that weren't suppose to be there, or because the TableView had the DataSource linked to it.

The result was a TableViewController with a static table.

نصائح أخرى

You need to create custom class for UITableViewCell, instead of creating it for UITableView, as table view contains tableViewCell, as the default ones, but your cell contains textFields which is not by default. Let me know if you need more clarity here

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top