UA-17470720-3

Jump to content


Photo
- - - - -

Can I maintain Edit mode into the detailed views?


  • Please log in to reply
12 replies to this topic

#1 Gary Stevenson

Gary Stevenson

    Jr. Member

  • STV 3.0 Pro
  • PipPip
  • 21 posts
Reputation: 1
Good

Posted 31 January 2012 - 03:45 PM

Hi,

For example: in the Core Data example app where there are Tasks and Task Steps is it possible that when you Edit an existing task that Edit mode is maintained when you go into a Task Step? At the moment the user has to tap on Edit again in each Task Step.

This is different from when you create a new Task where you can add Task Steps and edit them without having to tap Edit.

Also, in my particular App the detailed view has only one attribute which has a time picker. I would like, if possible, for the cell to be automatically chosen so the time picker automatically pops up. At the moment the user has to tap Edit, Tap the cell (which pops up the Time picker) and then Done and then back. It all seems a bit long-winded!

thanks,
Gary.

#2 dev1

dev1

    Sr. Member

  • STV 3.0 Pro
  • PipPipPip
  • 47 posts
Reputation: 2
Good

Posted 15 March 2012 - 12:27 PM

Could someone answer this one please? I have the same question.

#3 Tarek

Tarek

    Forum Admin

  • Administrators
  • 3670 posts
Reputation: 452
Popular

Posted 15 March 2012 - 05:31 PM

Hi guys,

@Gary: Thank you very much for the suggestion, I'll make sure this gets added to our feature requests and implement it ASAP.

For the time being, you guys can optionally set the detail view's edit mode using the following SCTableViewModelDelegate method:
- (void)tableViewModel:(SCTableViewModel *)tableViewModel detailViewDidAppearForRowAtIndexPath:(NSIndexPath *)indexPath withDetailTableViewModel:(SCTableViewModel *)detailTableViewModel
{
  [detailTableViewModel setModeledTableViewEditing:TRUE animated:TRUE];
}
Also, using the same above method, you can have your date cell receive focus by calling [myDateCell becomeFirstResponder].

Hope this helps.

#4 Gary Stevenson

Gary Stevenson

    Jr. Member

  • STV 3.0 Pro
  • PipPip
  • 21 posts
Reputation: 1
Good

Posted 20 March 2012 - 12:26 PM

In case anyone else wants to do this I have amended the code slightly so that Edit mode is only enabled automatically in the detailed view if it had already been selected in the view above.

- (void)tableViewModel:(SCTableViewModel *)tableViewModel detailViewDidAppearForRowAtIndexPath:(NSIndexPath *)indexPath withDetailTableViewModel:(SCTableViewModel *)detailTableViewModel
{
	if (detailTableViewModel.tag == 2) //Task Step detailed View
	{
		if (tableViewModel.modeledTableView.editing)
		{
			[detailTableViewModel setModeledTableViewEditing:TRUE animated:TRUE];
			
			// Select the first cell. For Date/Time cells causes picker to be displayed
			[[detailTableViewModel cellAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]] becomeFirstResponder];
		}
	}
}


#5 David DelMonte

David DelMonte

    Forum Master

  • STV 4.0 Pro
  • PipPipPipPipPipPipPip
  • 527 posts
Reputation: 41
Excellent

Posted 20 March 2012 - 04:46 PM

I'm curious. I have a setup much like your detail view. I never see the detailTableViewModel.tag go above 1.

Could you please list the methods that you are invoking..

David

#6 Gary Stevenson

Gary Stevenson

    Jr. Member

  • STV 3.0 Pro
  • PipPip
  • 21 posts
Reputation: 1
Good

Posted 21 March 2012 - 09:57 AM

David,

I suspect you are missing a

tableModel.autoAssignDelegateForDetailModels = YES;

?
Gary

#7 David DelMonte

David DelMonte

    Forum Master

  • STV 4.0 Pro
  • PipPipPipPipPipPipPip
  • 527 posts
Reputation: 41
Excellent

Posted 21 March 2012 - 10:20 AM

Hi Gary, thanks for answering. I do have that statement active. However, perhaps I am calling it in the wrong place. Where do you call it?

David

#8 Gary Stevenson

Gary Stevenson

    Jr. Member

  • STV 3.0 Pro
  • PipPip
  • 21 posts
Reputation: 1
Good

Posted 21 March 2012 - 10:34 AM

It's the last statement in my viewDidLoad.

Gary.

#9 David DelMonte

David DelMonte

    Forum Master

  • STV 4.0 Pro
  • PipPipPipPipPipPipPip
  • 527 posts
Reputation: 41
Excellent

Posted 21 March 2012 - 10:49 AM

Yep, same for me.. I'm hoping that Tarek's magic will allow more fine tuned access to specific views and rows in STV3.

If you have other ideas Gary, I'd welcome them, but thanks a lot for your responses.

David

#10 Tarek

Tarek

    Forum Admin

  • Administrators
  • 3670 posts
Reputation: 452
Popular

Posted 21 March 2012 - 02:06 PM

Hi David,

I suspect you're using a detail model and returning it via 'customDetailModelForRowAtIndexPath:'? If that's the case, then you should set autoAssign... for the custom model itself.

I'm hoping that Tarek's magic will allow more fine tuned access to specific views and rows in STV3.

It's amazing how things got so much easier now with the new 'Actions' feature in STV 3.0. In fact, in our tests we're rarely using delegates any more!

#11 David DelMonte

David DelMonte

    Forum Master

  • STV 4.0 Pro
  • PipPipPipPipPipPipPip
  • 527 posts
Reputation: 41
Excellent

Posted 21 March 2012 - 02:36 PM

Can I try three??? pleeeease..

Anyway, I plopped detailModel.autoAssignDelegateForDetailModels = YES; into the customDetailTableViewModelForRowAtIndexPath
method, Is that what you meant? I still cannot intercept to style the subviews and the main detail view does not reflect down...

If you say it will be easier in stv3, I will wait.

One other question though - a bit different. Split View Controller - in the root view, how do I allow users to move rows...?

THANKS

#12 Tarek

Tarek

    Forum Admin

  • Administrators
  • 3670 posts
Reputation: 452
Popular

Posted 21 March 2012 - 08:27 PM

You'll be able to try it very soon! :)

One other question though - a bit different. Split View Controller - in the root view, how do I allow users to move rows...?

If that's Core Data bound, just set the 'orderAttributeName' in the entity definition to a valid integer attribute in your entity. This will enable Core Data re-ordering. Of course you'll also need to put the table view in edit mode (easiest way: add an Edit button to the navigation bar and assign it to the tableModel's editButtonItem, as per our Core Data App example).

Hope this helps.

#13 David DelMonte

David DelMonte

    Forum Master

  • STV 4.0 Pro
  • PipPipPipPipPipPipPip
  • 527 posts
Reputation: 41
Excellent

Posted 21 March 2012 - 09:16 PM

Tarek, this is more complicated than I thought.. I'll take it to a separate thread...

David




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users