views:

107

answers:

2

I have a tableViewController/navController setup. I want to tap on the navbar of the navController to force the tableView back to the top row. I can see that the navbar is a UIView subclass, but I am unclear if I need to subclass it and implement the touch sequence methods.

I've build the view hierarchy in IB so I am reluctant to build it all programmatically just to enable tapping of the navbar.

Thanks, Doug

A: 

You can change what subclass any item is in interface builder. Just create your subclass, add it to your XCode project, and then you'll be able to enter it in as the class instead of the normal value.

For a simple example on how to override a class look here.

Epsilon Prime
+2  A: 

The OS already defines the "tap on the status bar" gesture to mean "scroll to the top of the current view." UIScrollView has a property scrollsToTop that controls this behavior, and UITableView inherits it.

Sixten Otto