Welcome, Guest
Username Password: Remember me

Tableview edit button not working while using Key Binding method(s)
(1 viewing) (1) Guest
  • Page:
  • 1

TOPIC: Tableview edit button not working while using Key Binding method(s)

Tableview edit button not working while using Key Binding method(s) 1 year ago #1

Tarek:

I am extremely pleased with the Sensible TableView framework and the level of support I have received so far.

Though I have come across one small road block.

Here's my application model:

I am using a remote data store/server to transfer information to and from the iPhone device so using the coredata managedobjectContext does not seem like a viable solution. I am using the KeyBinding method to display custom cells in my table view(s).

I load the custom cells into the tableView by processing an XML dataset received from an HTTP server call.

I would like to use the "built in" Navigation controller edit button to reorder/delete rows from the views but can't get it to work. The button shows (of course) but the tableView does not go into edit mode.

Is there a way to do this using KeyBinding?

Regards,

Scott
  • OneIron1
  • OFFLINE
  • Fresh Boarder
  • Posts: 14
  • Karma: 1

Re: Tableview edit button not working while using Key Binding method(s) 1 year ago #2

Hi Scott,

Thanks a lot for all the complements

Are you trying to remove STV's control cells? (e.g. SCTextFieldCell?) STV was designed to handle cell removal/re-ordering/addition automatically using classes like SCArrayOfStringsSection and SCArrayOfObjectsSection, where STV will automatically handle everything for you. Did you check these classes? Please tell me if you have different requirements. Thanks again!
  • tarekskr
  • OFFLINE
  • Administrator
  • Posts: 2402
  • Karma: 72

Re: Tableview edit button not working while using Key Binding method(s) 1 year ago #3

I'm using the following construct(s)... loadLocations is a method I've built that populates a (NSMutableArray *) aSubscribedLocations with location objects objects.
....

-(void) viewWillAppear:(BOOL)animated{
[self loadLocations];

// Instantiate the tabel model
tableModel = [SCTableViewModel alloc] initWithTableView:self.tableView withViewController:self];

SCTableViewSection *zozListSection = [SCTableViewSection sectionWithHeaderTitle:nil ];
[tableModel addSection: zozListSection];

int n, ZOZCount;

for ( n = 0, ZOZCount = [ self.aSubscribedLocationsArray count]; n < ZOZCount; n = n + 1 ){
zenZone *zozToLoad = [ self.aSubscribedLocationsArray objectAtIndex:n];

NSString *nameKey = [[NSString alloc] initWithFormat:@"zoneName%i", n] autorelease];
NSString *addressKey = [[NSString alloc] initWithFormat:@"zoneAddress%i",n] autorelease];

[tableModel.modelKeyValues setValue:zozToLoad.zoneName forKey:nameKey];
[tableModel.modelKeyValues setValue:zozToLoad.address1 forKey:addressKey];

NSDictionary *zoneData = [NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:nameKey, addressKey, nil]
forKeys:[NSArray arrayWithObjects:@"1", @"2", nil]];

SCControlCell *ZOZListCell = [SCControlCell cellWithText:nil withKeyBindings: zoneData withNibName:@"ZOZListCell"];

ZOZListCell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;
[zozListSection addCell: ZOZListCell];
}

}

...

The zozListCell is the custom cell (nib file). I couldn't find an documentation for using a custom Cell for SCArrayOfObjects section...I'll continue looking.
  • OneIron1
  • OFFLINE
  • Fresh Boarder
  • Posts: 14
  • Karma: 1

Re: Tableview edit button not working while using Key Binding method(s) 1 year ago #4

Hi again Scott,

Are you able to post a screen shot of this view so that I'd be able to get a better understanding of what you're trying to achieve? Thanks!
  • tarekskr
  • OFFLINE
  • Administrator
  • Posts: 2402
  • Karma: 72

Re: Tableview edit button not working while using Key Binding method(s) 1 year ago #5

Here's one example. Each row in the table is a class who's property values are set by values from an XML data file that is retrieved from a remote server, so there is no locally managed datastore (coredata).
Attachments:
  • OneIron1
  • OFFLINE
  • Fresh Boarder
  • Posts: 14
  • Karma: 1

Re: Tableview edit button not working while using Key Binding method(s) 1 year ago #6

Oh that's really simple...and you don't even need to use custom cells, unless you plan to make your cells more complex in the future.

Since you already have an existing array of location objects, your app will work almost out of the box with an SCArrayOfObjectsSection. Just pass the section the NSMutableArray of the location objects, along with the location object's class definition, and STV will literally handle everything else for you from there (e.g. deletion, re-ordering, editing existing locations, and even adding new ones). You'll also be able to fully customize the cells' font (and many others) inside the SCTableViewModelDelegate method called tableViewModel:willDisplayCell:forRowAtIndexPath:.

The closest example you can follow is that of our Overview App, under the object-binding tab. If you're still planning to use custom cells, you should also have a look at our Custom Cells App. Please tell me if you need any further help
  • tarekskr
  • OFFLINE
  • Administrator
  • Posts: 2402
  • Karma: 72
Last Edit: 1 year ago by tarekskr.
  • Page:
  • 1
Time to create page: 1.69 seconds