arrays – swift,将NSIndexpath转换为Int

arrays – swift,将NSIndexpath转换为Int,第1张

概述我有一个tableview,每个单元格都有一个按钮.当点击它时,我有一个didselectrow功能.我想使用我的indexpath从一个给出单元格内容的数组中获取一个值.如何将此NSIndexpath转换为要在数组中使用的int? 你最想要的是row属性.你可以看到一个 example here. func tableView(tableView: UITableView!, didSelect 我有一个tablevIEw,每个单元格都有一个按钮.当点击它时,我有一个dIDselectrow功能.我想使用我的indexpath从一个给出单元格内容的数组中获取一个值.如何将此NSIndexpath转换为要在数组中使用的int? 你最想要的是row属性.你可以看到一个 example here.
func tableVIEw(tableVIEw: UItableVIEw!,dIDSelectRowAtIndexPath indexPath: NSIndexPath!) {    let alert = UIAlertController(Title: "Item selected",message: "You selected item \(indexPath.row)",preferredStyle: UIAlertControllerStyle.Alert)    alert.addAction(UIAlertAction(Title: "OK",style: UIAlertActionStyle.Default,handler: {                                    (alert: UIAlertAction!) in println("An alert of type \(alert.style.hashValue) was tapped!")                                }))    self.presentVIEwController(alert,animated: true,completion: nil)}
总结

以上是内存溢出为你收集整理的arrays – swift,将NSIndexpath转换为Int全部内容,希望文章能够帮你解决arrays – swift,将NSIndexpath转换为Int所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://www.54852.com/web/1089813.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-27
下一篇2022-05-27

发表评论

登录后才能评论

评论列表(0条)

    保存