user3408069
user3408069

Reputation:

UIBarButtonItem accept only one tap

I have an UIBarButtonItem in my view with the title "Done", when is tapped it creates data in my tableview, the problem is that I need to set it only for one tap, because when its tapped more than once, the data is duplicated, is there a property or method to do that?

Thanks in advance.

Upvotes: 1

Views: 87

Answers (2)

andreelias
andreelias

Reputation: 238

After you filled up your table by tapping the button, you can disable it.

// Assuming the Done button is on the right side of the Navigation Bar
[self.navigationItem.rightBarButtonItem setEnabled:NO];

Upvotes: 2

iOSAppDev
iOSAppDev

Reputation: 2783

You can simply disable once user tapped it for first time. This will prevent user tap next time. Let me know of it helps

Upvotes: 0

Related Questions