- (voID)tableVIEw:(UItableVIEw *)tableVIEw dIDSelectRowAtIndexPath:(NSIndexPath *)indexPath { NSLog(@"dID select and the text is %@",[tableVIEw cellForRowAtIndexPath:indexPath].textLabel.text);] }
我找不到Swift的任何解决方案。打印indexpath.row是可能的,但这不是我需要的。
所以我该怎么做?或者这个代码的“Swift-version”是什么?
尝试这个:overrIDe func tableVIEw(tableVIEw: UItableVIEw,dIDSelectRowAtIndexPath indexPath: NSIndexPath) { let indexPath = tableVIEw.indexPathForSelectedRow() //optional,to get from any UIbutton for example let currentCell = tableVIEw.cellForRowAtIndexPath(indexPath) as UItableVIEwCell print(currentCell.textLabel!.text)总结
以上是内存溢出为你收集整理的uitableview – 如何获取swift中所选行的textLabel?全部内容,希望文章能够帮你解决uitableview – 如何获取swift中所选行的textLabel?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)