【问题标题】:One UIBarButtonItem with different selectors一个带有不同选择器的 UIBarButtonItem
【发布时间】:2016-04-14 14:33:22
【问题描述】:

我想为带有两个选择器的导航右键项目创建一个UIBarButtonItem。 When the UITableView enters editing mode the right button item has the title "Favorite All" with the (favAll) selector and when one row in the table view is selected this button title should be "favorite" with the (faveSome) selector?

如何创建一个带有两个标题和选择器的 UIBarButtonItem?

【问题讨论】:

  • 您只能有一个选择器。使用标志来确定点击按钮时要执行的操作。
  • 不创建一个,创建两个,默认保持“Fav All”,但选择一行后,将“Favorite”设置为右键。

标签: ios objective-c selector uibarbuttonitem


【解决方案1】:

答案是,这不是好的做法。

相反,您可以在操作上确定它应该为编辑模式/正常模式执行什么逻辑。

类似的东西;

@selector(edit:)

    - (IBAction)edit:(id)sender {
      if (self.isEditing) {

      }
    }

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-06-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多