Learn Courses My Dashboard

Create actions func with a certain tableView cell

Ok, how would you create action functions with a certain tableview cell almost like a “calculator menu” Because I’m trying to get this menu with the prices to show have the price show up on the textView after you press on the tableCell. But how would I distinguish which tableView cell was tapped?

Welcome to the community!

You’ll use the tableView delegate functions to distinguish when a table view cell is tapped, didSelectRowAt

More info here

1 Like

OK, But how would I write it to create an action from like the 3rd cell or one with a specific name for the cell.labelText.text ?

its basically the same when setting your cell values but you need to do something for a specific index,

so put a condition like
if(index==2) cell.labelText.text = “custom text”
else cell.labelText.text = “usual text”

You should research the basics about how to create tableViews

Yes I will, because I know if I master table views I’ll be able to master collection views also and then not have to look at swift tutorial videos as much! and hey, any help you need? Because I’d like to help you out for helping me out!

Lets hope I learn all about tableviews from this corse! and I hope he codes like Chris does, more storyboard usage.