Welcome, Guest
Username Password: Remember me

Jump Directly To Detail View of Item
(1 viewing) (1) Guest
  • Page:
  • 1

TOPIC: Jump Directly To Detail View of Item

Jump Directly To Detail View of Item 1 year, 8 months ago #1

How do I go from some view in my project directly to the detail view of an object in my SCTableView?
  • baberuth22
  • OFFLINE
  • Expert Boarder
  • Posts: 84
  • Karma: 2

Re: Jump Directly To Detail View of Item 1 year, 8 months ago #2

You just create a table view controller with an SCTableViewModel that has an SCObjectSection. A really easy way to do that is by using an SCTableViewController:

 
...
 
SCNavigationBarType navBarType;
if(self.navigationController)
navBarType = SCNavigationBarTypeNone;
else
navBarType = SCNavigationBarTypeDoneRightCancelLeft;
 
SCTableViewController *detailViewController = [[SCTableViewController alloc] initWithStyle:UITableViewStyleGrouped withNavigationBarType:navBarType];
 
SCObjectSection *objSection = [SCObjectSection sectionWithHeaderTitle:nil withBoundObject:myObj withClassDefinition:myObjClassDef];
[detailViewController.tableViewModel addSection:objSection];
 
if(self.navigationController)
{
[self.navigationController pushViewController:detailViewController animated:TRUE];
}

else
{
// Create the navigation controller
UINavigationController *detailNavController = [[UINavigationController alloc] initWithRootViewController:detailViewController];
[self presentModalViewController:detailNavController animated:TRUE];
[detailNavController release];
}
 
[detailViewController release];
 
...
 
 


Hope this helps
  • tarekskr
  • OFFLINE
  • Administrator
  • Posts: 2402
  • Karma: 72
Last Edit: 1 year, 8 months ago by tarekskr.

Re: Jump Directly To Detail View of Item 1 year, 8 months ago #3

That code worked great for adding the detail view with the exception of this warning "CALayer bounds contains NaN: [nan nan; 0 0]"

When the object is edited and I hit the done button, how do I fire a delegate to notify me that the editing is complete?

I tried setting the delegate to self and adding these delegate methods:

- (void)tableViewModel:(SCTableViewModel *)tableViewModel
itemCreatedForSectionAtIndex:(NSUInteger)index item:(NSObject *)item;
 
 
- (void)tableViewModel:(SCTableViewModel *)tableViewModel
itemAddedForSectionAtIndexPath:(NSIndexPath *)indexPath item:(NSObject *)item;
 
 
- (void)tableViewModel:(SCTableViewModel *)tableViewModel
itemEditedForSectionAtIndexPath:(NSIndexPath *)indexPath item:(NSObject *)item;
 
 


but none of the methods respond to the done button click. Should I manually add a selector? How?

Thanks so much!
  • baberuth22
  • OFFLINE
  • Expert Boarder
  • Posts: 84
  • Karma: 2

Re: Jump Directly To Detail View of Item 1 year, 8 months ago #4

I also made the view controller a SCTableViewModelDelegate and I am not sure if I need to add

detailViewController.delegate = self;


or

detailViewController.tableViewModel.delegate = self;


But the delegates are still not responding

Thanks again.
  • baberuth22
  • OFFLINE
  • Expert Boarder
  • Posts: 84
  • Karma: 2

Re: Jump Directly To Detail View of Item 1 year, 8 months ago #5

SCTableViewController has it's own delegate methods (please check the documentation for SCTableViewControllerDelegate). Just set the detailViewController.delegate property and implement the method tableViewControllerWillDisappear:cancelButtonTapped:doneButtonTapped: (please don't forget to conform to the SCTableViewControllerDelegate in the header file).

As for the warning, it has nothing to do with the detail view. This warning is issued when we manually set the contentInset property in our UITextView subclass. We set this property to have UITextView behave correctly when inside a cell. As far as I know, this is nothing to worry about.
  • tarekskr
  • OFFLINE
  • Administrator
  • Posts: 2402
  • Karma: 72
  • Page:
  • 1
Time to create page: 1.70 seconds