Welcome, Guest
Username Password: Remember me

Customize The DetailTableViewModel
(1 viewing) (1) Guest

TOPIC: Customize The DetailTableViewModel

Customize The DetailTableViewModel 1 year, 8 months ago #1

Can I see some sample code for customizing a detail view model please?


I want to have an imageView in the first line of the detailTableViewModel and I would like a switch in the navigationController allowing me to switch (flip) to an image only view.


I have this code so far, and it doesn't work for me. I am using a bound array of objects.

 
 
 
- (void)tableViewModel:(SCTableViewModel *)tableViewModel detailViewWillAppearForSectionAtIndex:(NSUInteger)index withDetailTableViewModel:(SCTableViewModel *)detailTableViewModel
{
//SCTableViewSection *detailSection = [detailTableViewModel sectionAtIndex:0];
//SCTableViewCell *imagePickerCell = [detailSection cellAtIndex:0];
 
//SCObjectSection *detailSection = [detailTableViewModel sectionAtIndex:0];
//SCObjectCell *imagePickerCell = [detailTableViewModel cellAtIndexPath:index];
//Shoe *myManagedObject = detailSection.boundObject;
//
// Set your managed object's attributes normally here
NSLog(@"IDetwail will appear");
}
 
  • baberuth22
  • OFFLINE
  • Expert Boarder
  • Posts: 84
  • Karma: 2

Re: Customize The DetailTableViewModel 1 year, 8 months ago #2

Do you want these customizations as seperate UI elements, or as UI elements within Sensible TableView cells?
  • tarekskr
  • OFFLINE
  • Administrator
  • Posts: 2402
  • Karma: 72

Re: Customize The DetailTableViewModel 1 year, 8 months ago #3

The imageView would be inside the cell.

The switch would be in the navBar and flip from the detailViewTable to a full screen image and back.
  • baberuth22
  • OFFLINE
  • Expert Boarder
  • Posts: 84
  • Karma: 2

Re: Customize The DetailTableViewModel 1 year, 8 months ago #4

Your code should work fine (just please remember to conform to the SCTableViewModelDelegate protocol in your header file). Here is also some code to illustrate what you want:

 
- (void)tableViewModel:(SCTableViewModel *)tableViewModel detailViewWillAppearForSectionAtIndex:(NSUInteger)index withDetailTableViewModel:(SCTableViewModel *)detailTableViewModel
{
SCNavigationBar *detailNavBar = detailTableViewModel.viewController.navigationController.navigationBar;
// Now add here any view you want to the navigation bar
...
 
 
SCTableViewSection *detailSection = [detailTableViewModel sectionAtIndex:0];
SCTableViewCell *detailCell = [detailSection cellAtIndex:myCellIndex];
detailCell.imageView.image = [UIImage imageNamed:@"myImage"];
 
... // etc., you get the idea
}
 
  • tarekskr
  • OFFLINE
  • Administrator
  • Posts: 2402
  • Karma: 72

Re: Customize The DetailTableViewModel 1 year, 8 months ago #5

Using that delegate
detailViewWillAppearForSectionAtIndex:(NSUInteger)index
, how would I get the cell index AND Section Index?

I was expecting an NSIndexPath instead of an NSInteger.
  • baberuth22
  • OFFLINE
  • Expert Boarder
  • Posts: 84
  • Karma: 2

Re: Customize The DetailTableViewModel 1 year, 8 months ago #6

detailViewWillAppearForSectionAtIndex should be used when a new item is created. For access to cell detail views, please use:

tableViewModel:detailViewWillAppearForRowAtIndexPath:withDetailTableViewModel:
  • tarekskr
  • OFFLINE
  • Administrator
  • Posts: 2402
  • Karma: 72
Time to create page: 1.91 seconds