Welcome, Guest
Username Password: Remember me

Completely replace built-in detail view for SCArrayOfObjectsSections?
(1 viewing) (1) Guest
  • Page:
  • 1

TOPIC: Completely replace built-in detail view for SCArrayOfObjectsSections?

Completely replace built-in detail view for SCArrayOfObjectsSections? 1 year, 1 month ago #1

Hi Tarek, (I hope, the master himself grabs this question ),

I have a requirement to completely replace the generated detail view for a section of type SCArrayOfObjectsSection. My detail view needs to have a very specific look and also present a map, using MapKit.

It's for a store locator type of app where I show a list of stores via SCArrayOfObjectsSection but when the user drills down (= selects an entry), I want to show store details and an embedded map.

Is this possible? How can I do this? If you would point me into the right direction, that would be of great help.

My SCArrayOfObjectsSection is making use of the fantastic, amazing, exciting STV 2.0 custom cells feature. (By the way: That alone is worth the money!)
  • RalfR
  • OFFLINE
  • Fresh Boarder
  • Posts: 16
  • Karma: 0
--
twitter: twitter.com/24z
about: about.me/24z

Re: Completely replace built-in detail view for SCArrayOfObjectsSections? 1 year, 1 month ago #2

Hi Ralf,

Thanks a lot for all the complements

You can easily override SCArrayOfObjectsSection default detail view by implementing the didSelectRowAtIndexPath delegate method and presenting your own detail view there:

 
- (void)tableViewModel:(SCTableViewModel *)tableViewModel didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
SCTableViewSection *section = [tableViewModel sectionAtIndex:indexPath.section];
if([section isKindOfClass:[SCArrayOfObjectsSection class]])
{
SCArrayOfObjectsSection *objectsSection = (SCArrayOfObjectsSection *)section;
 
// Get the selected object (you can cast your object here to whatever class the object is an instance of)
NSObject *selectedObject = [objectsSection.items objectAtIndex:indexPath.row];
 
// display your custom detail view here
...
}
}
 


Hope this helps!
  • tarekskr
  • OFFLINE
  • Administrator
  • Posts: 2404
  • Karma: 72

Re: Completely replace built-in detail view for SCArrayOfObjectsSections? 1 year, 1 month ago #3

Works, like a charm!

Question: As stated in the initial post, the requirement of the detail view is to show an embedded map. Would you recommend to put a MapKit based map into a custom cell? Did you ever do so?
  • RalfR
  • OFFLINE
  • Fresh Boarder
  • Posts: 16
  • Karma: 0
--
twitter: twitter.com/24z
about: about.me/24z

Re: Completely replace built-in detail view for SCArrayOfObjectsSections? 1 year, 1 month ago #4

Great!

I never tried a MapKit map in a cell before. I am sure it adds some overhead, but that could very well be negligible (needs testing). Why are you thinking of doing so Ralf?
  • tarekskr
  • OFFLINE
  • Administrator
  • Posts: 2404
  • Karma: 72
Last Edit: 1 year, 1 month ago by tarekskr.

Re: Completely replace built-in detail view for SCArrayOfObjectsSections? 1 year, 1 month ago #5

It's actually really simple. Given that SCControlCell lets me access each subview/control via its unique tag, it basically was some 3-4 lines of code. STV rocks!
  • RalfR
  • OFFLINE
  • Fresh Boarder
  • Posts: 16
  • Karma: 0
--
twitter: twitter.com/24z
about: about.me/24z
  • Page:
  • 1
Time to create page: 0.92 seconds