Wednesday, 15 February 2012

ios - How to pass indexPath.row of the dragged cell into a function? (SWIFT) -



ios - How to pass indexPath.row of the dragged cell into a function? (SWIFT) -

currently, have tableview different "user profile pictures" populating each cell. drag image past point horizontally, triggers function. done uipangesturerecogniser.

my problem is, how pass indexpath.row of dragged image function, function knows "user" work with? right has no way of knowing cell dragged.

if outline general direction of how can done grateful!

this work:

in cellforrowatindexpath, set tag property of image row number.

// allow pan = uipangesturerecognizer(target: self, action: "handlepan:") cell.image.addgesturerecognizer(pan) cell.image.tag = indexpath.row

in handler pan:

func handlepan(recognizer: uipangesturerecognizer) { if allow row = recognizer.view?.tag { // utilize row number println("row number \(row)") } }

ios uitableview swift

No comments:

Post a Comment