UITableViewCell setting text

后端 未结 3 927
南旧
南旧 2021-01-11 16:20

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 deprecat

相关标签:
3条回答
  • 2021-01-11 16:52

    In Swift 3.0 its should be

     cell.textLabel?.text = "Hello World"
    
    0 讨论(0)
  • 2021-01-11 16:58

    set cell label text

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

    and detail label text

    cell.detailTextLabel.text = @"yourText";
    
    0 讨论(0)
  • 2021-01-11 17:03

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

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

    and detail label text:

    [[cell detailTextLabel] setText:@"Hello World"];
    
    0 讨论(0)
提交回复
热议问题