Swift - 如何将 indexPathForRowAtPoint 值转换为 int
Swift - How to convert indexPathForRowAtPoint value in int
我在 UITableView
上使用了长按 TapGesture
然后我创建了一个变量 indexPath
问题是如何将 indexpath
值转换为整数因为我已经使用UITableView
索引路径中的此值我无法将此值用作整数
这是我的代码
func cellLongPressed(recognizer: UILongPressGestureRecognizer) {
let point = recognizer.locationInView(tbl_LLTrandingJive)
let indexPath = tbl_LLTrandingJive.indexPathForRowAtPoint(point)
if indexPath == nil {
} else if recognizer.state == UIGestureRecognizerState.Began {
var getin:int = (indexPath?.row)?.toIntMax()
println("LONG indexPath_localTable:\(indexPath?.row)")
myarray.ovjecatindex(0)
}
得到你需要的行数
indexPath.row //current row number in section
如果你有部分比
indexPath.section //current section number
你不能直接将它转换为 int,因为它是复杂的对象。
我在 UITableView
上使用了长按 TapGesture
然后我创建了一个变量 indexPath
问题是如何将 indexpath
值转换为整数因为我已经使用UITableView
索引路径中的此值我无法将此值用作整数
这是我的代码
func cellLongPressed(recognizer: UILongPressGestureRecognizer) {
let point = recognizer.locationInView(tbl_LLTrandingJive)
let indexPath = tbl_LLTrandingJive.indexPathForRowAtPoint(point)
if indexPath == nil {
} else if recognizer.state == UIGestureRecognizerState.Began {
var getin:int = (indexPath?.row)?.toIntMax()
println("LONG indexPath_localTable:\(indexPath?.row)")
myarray.ovjecatindex(0)
}
得到你需要的行数
indexPath.row //current row number in section
如果你有部分比
indexPath.section //current section number
你不能直接将它转换为 int,因为它是复杂的对象。