On Oct 9, 2015, at 21:36 , Alex Hall <[email protected]> wrote:
> 
> I'm playing with tables on iOS, because they're central to many apps but I've 
> never really used them. I have a UITableView displaying rows of data, which 
> is good, but tapping on a row does nothing, which is the problem. I've made a 
> segue from the "detail" view to the table cell, and prepareForSegue() is 
> implemented in the table view's view controller. Yet, the detail view never 
> shows up in the app.
> 
> I'm pretty sure my problem is that my cell isn't officially part of my table. 
> The table didn't come with any cells, so I dragged one over. Tutorials say 
> that I should control-drag from the cell to the table, but that doesn't do 
> anything with VoiceOver, and I can't see why I'd have to do it anyway. The 
> cell is already nested in the table; can't Xcode work out the relationship 
> from there? Of course, this may already be all set, and the problem is 
> elsewhere.
> 
> I guess my question for the list is: how do I make sure my cell is connected 
> to my table so that it, not one generated in the data source, is the one 
> used? If my cell isn't used, the segue won't be attached and nothing would 
> happen when a cell were tapped, which is what I'm seeing.

I’m not quite sure what to make of your description here. You seem to talking 
about tapping on a row to go to a detail view, sort of like in the Settings 
app, but you said you made a segue from the detail view to the table cell, 
which seems like the wrong direction.

Also, the are two kinds of UITableViews — really, two ways of using 
UITableView. One is with static cells, where the row structure is fixed in 
advance (again like the Settings app), the other is with dynamic cells, where 
the data source determines what the rows are.

If your table is configured with static cells, then it should show the exact 
cells designed in IB. In that case, you don’t want a data source (and probably 
shouldn’t have one, but it’s a while and several iOS versions since I’ve done 
this, so my memory of the details is hazy).

If your table is configured with dynamic cells, you can add other cells to the 
IB design, but you need to choose which kind of cell gets created for any given 
row by instantiating it in ‘tableView:cellForRowAtIndexPath:’ with the correct 
cell identifier.

In neither case is there any control-dragging (that I can remember) to 
configure the cell into its table. Maybe the tutorials were talking about 
control-dragging to create a segue from the cell to another table that is 
actually the detail view?

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/xcode-users/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to