Welcome, Guest
Username Password: Remember me

Can a controller managed by SCTVModel be pushed in a navig. hierarchy?
(1 viewing) (1) Guest
  • Page:
  • 1

TOPIC: Can a controller managed by SCTVModel be pushed in a navig. hierarchy?

Can a controller managed by SCTVModel be pushed in a navig. hierarchy? 1 year, 6 months ago #1

I have a normal UITableViewController that is using SCTableViewModel to generate its table view. Everything in it (some SCSwitchCells and a SCSelectionCell) work correctly when I present it with a UINavigationController using -presentModalViewController:animated:.

However, if the same controller is pushed using -pushViewController:animated: inside a navigation hierarchy, the generated details controller doesn't preserve the user selection or store it in the bound value. The switch cells do work correctly though. My invocation for the SCSelectionCell:
 
SCSelectionCell* selectionCell = [SCSelectionCell cellWithText:@"Deletion Option"
withBoundObject:self
withSelectionStringPropertyName:@"deletionOption"
withItems:[NSArray arrayWithObjects:@"sel1", @"sel2", nil]];
 


The bound object is the SCTableViewModel's UITableViewController and the "deletionOption" property is a NSString.

I am using iOS 4.2 and SensibleTableView 1.6.
  • juan
  • OFFLINE
  • Fresh Boarder
  • Posts: 3
  • Karma: 0

Re: Can a controller managed by SCTVModel be pushed in a navig. hierarchy? 1 year, 6 months ago #2

Hi Juan,

I was just discussing the same exact issue with Matthew Purcell a couple of days ago. He sent me his project and it turned out that he was adding the main navigation controller as a subview of the main view controller, instead of pushing it or presenting it modally. UINavingationController does not support this, and will not forward/call the willAppear/willDisappear methods of its detail views, which is required by SCSelectionCell to function correctly. The only time (I know of) that you can add a UINavigationController as a subview to a UIViewController subclass is when you add it to a UIWindow.

If you are able to send this project to our support email, or alternatively post some more code regarding how you're creating the navigation controller, I'll be glad to pin point where the problem is. Thanks!
  • tarekskr
  • OFFLINE
  • Administrator
  • Posts: 2402
  • Karma: 72

Re: Can a controller managed by SCTVModel be pushed in a navig. hierarchy? 1 year, 6 months ago #3

Hello tarekskr,

It is my bad: I am doing exactly what you say. I had heard that warning before, yet since my view controller was apparently working correctly, I left it that way.

I will refactor the code so the nav controller view is added to the window instead. Thanks!
  • juan
  • OFFLINE
  • Fresh Boarder
  • Posts: 3
  • Karma: 0

Re: Can a controller managed by SCTVModel be pushed in a navig. hierarchy? 1 year, 6 months ago #4

Adding the UINavigationController's view to the window instead of as a subview of another UIView fixed the problem.
  • juan
  • OFFLINE
  • Fresh Boarder
  • Posts: 3
  • Karma: 0

Re: Can a controller managed by SCTVModel be pushed in a navig. hierarchy? 1 year, 6 months ago #5

Great! Thanks a lot Juan for posting the solution.
  • tarekskr
  • OFFLINE
  • Administrator
  • Posts: 2402
  • Karma: 72
  • Page:
  • 1
Time to create page: 0.87 seconds