iOS – UISEARCHBAR with UISTORYBOARD: segues and custom cells cannot work properly

I am using a storyboard and want to implement a UISearchbar for my UITableView. UISearchbarController generates a new UITableView, I use the following strategy:

< /p>

if (tableView == self.tableView)
//Populate table view with normal data
else
//Populate table view with search data

The first question is to deal with custom cells. I have to instantiate them in cellForRowAtIndexPath. Normally you would do this from a nib file. How can I do this with a storyboard? dequeueReusableCellWithIdentifier returns nil.

The second question involves the segue from the table view to the detailed view. The segue is started in the normal table view, but not in the search table view. Since the storyboard hides everything, I don’t Know how to assign segue to cells of search table view.

Can anyone help? Thanks!

Regarding the first question, I solved it by changing the ViewController type from UITableViewController to UIViewController, and then Add a table view and add an IBOutlet to the table view

@property (strong, nonatomic) IBOutlet UITableView *_tableView;

Table cell out column

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
MyTableViewCell *cell =[_tableView dequeueReusableCellWithIdentifier:productMasterCellIdentifier];
// .. modify your cell
return cell;
}

I am using stories I want to implement a UISearchbar for my UITableView. UISearchbarController generates a new UITableView, I use the following strategy:

if (tableView == self.tableView) 
//Populate table view with normal data
else
//Populate table view with search data

The first question is to deal with custom cells. I have to Instantiate them in cellForRowAtIndexPath. Normally you would do this from a nib file. How do I do this with a storyboard? dequeueReusableCellWithIdentifier returns nil.

The second question involves the segue from the table view to the detailed view. The segue is started in the normal table view, but not in the search table view. Since the storyboard hides everything, I don’t Know how to assign segue to cells of search table view.

Can anyone help? Thanks!

Regarding the first question, I solved it by changing the ViewController type from UITableViewController to UIViewController, then adding a table view in it and adding an IBOutlet for the table view < p>

@property (strong, nonatomic) IBOutlet UITableView *_tableView;

Use sockets to get table cells out of columns

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
MyTableViewCell *cell=[_tableView dequeueReusableCellWithIdentifier:productMasterCellIdentifier];
// .. modify your cell
return cell;
}

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 3901 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.