【问题标题】:How to remove arrow in UITableView如何在 UITableView 中删除箭头
【发布时间】:2023-03-29 06:07:01
【问题描述】:

我正在处理UITableView。请告诉我如何删除每一行显示的箭头按钮?

【问题讨论】:

    标签: ios objective-c uitableview


    【解决方案1】:

    -tableView:cellForRowAtIndexPath: 中,将 UITableViewCell 的 accessoryType 属性设置为 UITableViewCellAccessoryNone,这是默认的仅供参考

    【讨论】:

    • FWIW,默认与否,我也有同样的问题。它可能在 Interface/Storyboard Builder 中设置,和/或可能(就像在我的情况下)我需要一些单元格来指示更多细节,而其他则不需要。不过感谢您的回答!
    【解决方案2】:

    如果您使用的是界面生成器,只需选择您的单元格并将accessory 设置为none

    【讨论】:

      【解决方案3】:
      //Write following code into your program
      
      
      -(UITableViewCellAccessoryType)tableView:(UITableView *)tv accessoryTypeForRowWithIndexPath (NSIndexPath *)indexPath {
      
          return UITableViewCellAccessoryNone;
      }
      
      //Create a table for different section of app
      
      -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
      
       cell.accessoryType = UITableViewCellAccessoryNone;
      
      }
      

      //VKJ

      【讨论】:

      • accessoryTypeForRowWithIndexPath 方法在 Swift 上不可用
      【解决方案4】:

      对于 c# 用户:

      UITableViewCell cell = new UITableViewCell(); 
      
      cell.Accessory = UITableViewCellAccessory.None;
      

      【讨论】:

        【解决方案5】:

        适用于 Swift 3

        cell.accessoryType = UITableViewCellAccessoryType.none
        

        【讨论】:

          【解决方案6】:

          对于斯威夫特

          cellForRowAtIndexPath 方法的末尾添加以下内容 return.

              cell.accessoryType = UITableViewCellAccessoryType.None
          

          它只是完美的工作!

          【讨论】:

            猜你喜欢
            • 1970-01-01
            • 2014-09-02
            • 1970-01-01
            • 2015-03-14
            • 2014-08-17
            • 1970-01-01
            • 2018-11-08
            • 1970-01-01
            • 1970-01-01
            相关资源
            最近更新 更多