开发者

UITableViewCell setting text

开发者 https://www.devze.com 2023-01-21 15:22 出处:网络
I am creating sample hello world application. The code is below. How can i removed the warning at c[cell setText:@\"Hello World\"]; in the code below as it deprecated.

I am creating sample hello world application. The code is below. How can i removed the

warning at c[cell setText:@"Hello World"]; in the code below as it deprecated.

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier开发者_JAVA技巧:CellIdentifier];

[cell setText:@"Hello World"];


set cell label text

cell.textLabel.text = @"Hello World";

and detail label text

cell.detailTextLabel.text = @"yourText";


There's also more Objective-C way of doing that:

[[cell textLabel] setText:@"Hello World"];

and detail label text:

[[cell detailTextLabel] setText:@"Hello World"];


In Swift 3.0 its should be

 cell.textLabel?.text = "Hello World"
0

精彩评论

暂无评论...
验证码 换一张
取 消