max_
max_

Reputation: 24481

Disable tableView, but enable UINavigationController's back button

I am disabling a UITableView while displaying a UIActivityIndicatorView, and I just wanted to know how I could enable the UINavigationController's back button while the UITableView is disabled?

Upvotes: 1

Views: 2537

Answers (2)

mrapplehead
mrapplehead

Reputation: 56

I assume you meant to disable any user events from UITableView. Recall UINavigationController user events queue is independent of UITableView user events. So, by disabling UITableView the UINavigationController isn't affected.

Set the views userInteractionEnabled boolean value property to NO. This ignores user events and removes UITableView user events from the queue. i.e. controller.view.userInteractionEnabled = NO; OR self.view.userInteractionEnable = NO; (depending where your setting the property).

and right before disabling UITableView set the UINavigationItem property assuming the UINavigationController property is not hidden. The UINavigationItem will use the default "back" UIBarButtonItem if no new lefBarItem is set. i.e. [self.navigationItem setHidesBackButton:NO animated:YES];

Upvotes: 2

Ash Furrow
Ash Furrow

Reputation: 12421

What do you meant by disabling the UITableView? Do yo mean disabling the scroll? UITableView inherits from UIScrollView, so you can change the scrollEnabled property to NO, which shouldn't affect the UINavigationController at all.

Upvotes: 0

Related Questions