Welcome, Guest
Username Password: Remember me

When do I use didSelectRowAtIndex and customDetailViewForRowAtIndex ?
(1 viewing) (1) Guest
  • Page:
  • 1

TOPIC: When do I use didSelectRowAtIndex and customDetailViewForRowAtIndex ?

When do I use didSelectRowAtIndex and customDetailViewForRowAtIndex ? 1 year, 2 months ago #1

I am just switching my app to use SensibleTableView in my main Edit Record area for my database app. I have 17 different field types in my app. Nearly every one has its own custom detail view which lets you edit the value. Some share the same view controllers for editing their data. For example, I have a Date, Time, and Date & Time field which all share the same custom detail view controller. The date picker just changes depending on the type. And my Date & Time field also has options for setting local notifications.

The problem I'm having is when I tap on a date field cell, the table gets resized to fit a table cell, but then my custom date cell editor comes into view. When I navigate back, the table view is still resized to show a blank area below, leaving an area for the date picker. I'm providing my own date picker in my custom detail view, so I don't need the main screen's table to resize.

I've passed my table model from the main view to the detail view in both didSelectRowAtIndex and customDetailViewForRowAtIndex and created willAppear and willDisappear methods calling prepareModelForCustomDetailViewAppearing and prepareModelForCustomDetailViewDisappearing accordingly.

I'm thinking I don't need both didSelect... and customDetailView... methods. But I'm not sure when each are used.

Thanks!

Brendan
  • tapforms
  • OFFLINE
  • Expert Boarder
  • Posts: 120
  • Karma: 4
Thanks!
Brendan
www.tapforms.com

Re: When do I use didSelectRowAtIndex and customDetailViewForRowAtIndex ? 1 year, 2 months ago #2

Hi Brendan,

The methods customDetailViewForRowAtIndexPath and customTableViewModelForRowAtIndexPath are most commonly used when you have an iPad application with a split view controller (please check the "iPad App" sample application). Please note that when you use these methods, you usually provide an empty model (or view controller in some cases) and STV will generate all of its contents. This makes these methods not suitable for cases where you want to provide your own completely revamped custom detail view.

For these cases, you should use the didSelectRowAtIndexPath method and push or presentModal your own detail view. However, this will not work for SCDateCell (and several other SCControlCell descendants), as SCDateCell already provides its own implementation of the method. The correct way to have SCDateCell provide your own custom detail view is to subclass it, then override the "didSelectCell" method and push your detail view there. Also, when your detail view disappears, you should set self.datePicker.date to the new date value (chosen by the user in your detail view), then call [self commitDetailViewChanges].

Please tell me if you need any more help.
  • tarekskr
  • OFFLINE
  • Administrator
  • Posts: 2402
  • Karma: 72

Re: When do I use didSelectRowAtIndex and customDetailViewForRowAtIndex ? 1 year, 2 months ago #3

Hi Brendan,

On a different note, please check the following post, which should be relevant if you're presenting custom detail views in your app: www.sensiblecocoa.com/forum/bug-reports/...=6&start=12#2119
  • tarekskr
  • OFFLINE
  • Administrator
  • Posts: 2402
  • Karma: 72
  • Page:
  • 1
Time to create page: 1.28 seconds