Welcome, Guest
Username Password: Remember me

Deselect row after adding it
(1 viewing) (1) Guest
  • Page:
  • 1
  • 2

TOPIC: Deselect row after adding it

Deselect row after adding it 1 year, 5 months ago #1

Hey,

I have a Core Data powered app with a view controller which contains an add button in the navigation bar. This button presents a view controller which has been automatically generated by Sensible TableView.
When I enter some data in this view controller and tap "Done", so that this view controller disappears, the new cell has been added to the tableModel. That's great.

But this cell is selected by default. It's highlighted blue (see screenshot). How can I disable this behavior?

Thanks,
Patrick

Bildschirmfoto_2010_11_29_um_23.png
  • Patrick
  • OFFLINE
  • Senior Boarder
  • Posts: 49
  • Karma: 3
Last Edit: 1 year, 5 months ago by Patrick.

Re: Deselect row after adding it 1 year, 5 months ago #2

Hey Patrick,

Assuming that your view controller is a UITableViewController, please set its clearsSelectionOnViewWillAppear property to TRUE.
  • tarekskr
  • OFFLINE
  • Administrator
  • Posts: 2402
  • Karma: 72

Re: Deselect row after adding it 1 year, 5 months ago #3

Thanks, Tarek.
Unfortunately that doesn't work for me.

My view controller is a UITableViewController and I set self.clearsSelectionOnViewWillAppear = YES; in viewDidLoad.

I just wonder why the cell is selected (by default) after it has been added by STV? Isn't that a strange behavior? Why should I want to have the cell selected, which has been added just a moment ago?
  • Patrick
  • OFFLINE
  • Senior Boarder
  • Posts: 49
  • Karma: 3

Re: Deselect row after adding it 1 year, 5 months ago #4

Hi Patrick,

We can have this optional in our next release. We can create a BOOL section property called something like "selectCellAfterCreation", which you will be able to set to FALSE.
  • tarekskr
  • OFFLINE
  • Administrator
  • Posts: 2402
  • Karma: 72

Re: Deselect row after adding it 1 year, 5 months ago #5

Hi Tarek,

that would be great.
But how I do I fix that temporarily?

self.clearsSelectionOnViewWillAppear = YES; doesn't work — even not in your "Core Data App" demo:
- Tap the Add button
- Enter a name
- Tap Done
= The cell is selected
  • Patrick
  • OFFLINE
  • Senior Boarder
  • Posts: 49
  • Karma: 3

Re: Deselect row after adding it 1 year, 5 months ago #6

For now you can just deselect the row using [tableModle.modeledTableView deselectRowsAtIndexPaths:]. Please tell me if you need any more help.
  • tarekskr
  • OFFLINE
  • Administrator
  • Posts: 2402
  • Karma: 72
  • Page:
  • 1
  • 2
Time to create page: 1.53 seconds