views:

351

answers:

0

Hi folks, this is my first post and i would appreciate any help you would be kind enough to offer. I have varied coding experience but all on windows based machines and have been thrown in at the deep-end with objective-c and cocoa touch.

My program has a UITabBarController to access different formatted tableViews of a series of data records. Each tabBarButton is linked to a tableViewController with a navigationBar allowing me to drill down a sequences of pages. The navigation layers on the first tab are organized thus:

(a)list Of Users-> (b)list Of Items For User-> (c)display Item

I needed a way of performing operations on the data at level b: ie delete all records (for this user) add new item (to user's list)

This (i thought) was straightforward and created a right hand navigationBarButton which calls a function invoking a UIActionSheet, presenting the choices of action available (add, delete, reset etc).

Here is the problem:

If the chosen action is to delete the items for that user, I can call [reloadData] to update the underlying tableView from within the UIActionSheet delegate. However, if the tableView is empty i want to drill back up the hierachy (to go from b back to a) as there is no point showing an empty table, and it saves the left hand navigationButton from having to be unnecessarily pressed. I do not seem to be able to do this from within the delegate (the UIActionSheet being a subview (i think)) and any attempt i make leads the program to crash most horribly with just about any error you care to mention.

I have tried:

-calling popViewControllerAnimated from within the UIActionSheet delegate

-storing a direct reference to UIViewController_B and calling popViewControllerAnimated on that from within the UIActionSheet delegate.

-calling performSelector afterDelay to trigger a function in UIViewController_B containing popAnimatedViewController and then immediately calling resignFirstResponder from UIActionSheet.

Also I am running short on headache tablets. Any advice gratefully received

related questions