开发者

Differentiate between no selection and selection at index 0 in UITableView

开发者 https://www.devze.com 2023-03-02 21:15 出处:网络
I have a UITableView and a UIButton.When the UIButton is pressed,开发者_如何学运维 it prints the text of the UITableViewCell that is selected to the console output.

I have a UITableView and a UIButton. When the UIButton is pressed,开发者_如何学运维 it prints the text of the UITableViewCell that is selected to the console output.

However, when no selection is made on the UITableView, it defaults to row 0, and displays this text.

How can I determine if there is no selection made, so that I can bring up a UIAlert?


Perhaps you can try storing the index of the cell when the didSelectRowAtIndexPath: method triggers. That way you can keep track of whether the user has selected a row since the view has been shown

0

精彩评论

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