不推荐使用 SetText [英] SetText is Deprecated

查看:56
本文介绍了不推荐使用 SetText的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究 Xcode 和 Obj-C,但收到此警告:

Hi I am working out Xcode and Obj-C and I am getting this warning:

弃用:不推荐使用setText:"

Deprecations: 'setText:' is deprecated

我想知道新方法是什么

这是我的代码:

[cell setText:[NSString stringWithFormat:@"I am cell %d", indexPath.row]];

推荐答案

setText 确实已弃用.使用 textLabel setText 代替:

setText is indeed deprecated. Use textLabel setText instead:

cell.textLabel.text = [NSString stringWithFormat:@"I am cell %d", indexPath.row];

这篇关于不推荐使用 SetText的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆