UA-17470720-3

Jump to content


Photo
- - - - -

Please Help - doneButtonTapped action not working

actions view-controllers

  • Please log in to reply
2 replies to this topic

#1 dkbowers51163

dkbowers51163

    Starting Out

  • STV 3.0 Std
  • Pip
  • 3 posts
Reputation: 3
Good

Posted 31 May 2013 - 01:02 PM

Hi all,

 

I am experimenting with STV to learn it before I use it for an app I want to write.  In this app I want to be able to trigger an update to an entity when the entity displayed in the tableview has a new row added to it.  I figure the best place to do that is in the doneButtonTapped action of the SCTableViewController .  Unfortunately I can't get it to work.  The code block is not executed when I add a new item and click the done button.  Here is my .h and .m file.  I am not using a xib file, in fact I am taking the core data sample and modifying it for this learning exercise.  The one thing I see in the debugger is this message "2013-05-31 16:55:36.469 Core Data App[819:c07] Application windows are expected to have a root view controller at the end of application launch" which I am not sure is a problem. Everything works except what I want to do with the done button.   :(

 

If anyone spots anything I am doing wrong or can make a suggestion I would greatly appreciate it.  By the way, I am a fairly experienced programmer but I am an iOS and Objective C noob.  Thanks in advance,

 

Dave

 

 

//  SettingsViewController.h

 

#import <SensibleTableView/SensibleTableView.h>

 

@interface SettingsViewController : SCTableViewController

 

@end

 

 

//  SettingsViewController.m

 

#import "SettingsViewController.h"

#import "Core_Data_AppAppDelegate.h"

 

@interface SettingsViewController ()

 

@end

 

@implementation SettingsViewController

 

- (void)viewDidLoad

{

    [super viewDidLoad];

    

    self.navigationBarType = SCNavigationBarTypeAddRightEditLeft;

    

    // Get managedObjectContext from application delegate

    Core_Data_AppAppDelegate *appDelegate = (Core_Data_AppAppDelegate *)[UIApplication sharedApplication].delegate;

    NSManagedObjectContext *managedObjectContext = appDelegate.managedObjectContext;

 

    // Create the Category definition

    SCEntityDefinition *categoryDef = [SCEntityDefinition definitionWithEntityName:@"CFCategoryEntity" managedObjectContext:managedObjectContext propertyNamesString:@"name;recurring;dayOfMonth;amount;active;order"];

[categoryDef propertyDefinitionWithName:@"name"].type = SCPropertyTypeTextField;

[categoryDef propertyDefinitionWithName:@"recurring"].type = SCPropertyTypeSwitch;

[categoryDef propertyDefinitionWithName:@"dayOfMonth"].type = SCPropertyTypeNumericTextField;

    [categoryDef propertyDefinitionWithName:@"amount"].type = SCPropertyTypeNumericTextField;

    [categoryDef propertyDefinitionWithName:@"active"].type = SCPropertyTypeSwitch;

    // dont need order thats going to come from dragging them arounf

 

    // Create the the categories section

    SCArrayOfObjectsSection *categoriesSection = [SCArrayOfObjectsSection sectionWithHeaderTitle:nil entityDefinition:categoryDef];

    categoriesSection.addButtonItem = self.addButton;

    categoriesSection.placeholderCell = [SCTableViewCell cellWithText:@"Please add what you will spend money on and any recurring additions of money." textAlignment: NSTextAlignmentCenter];

    categoriesSection.addButtonItem = self.addButton;

    [self.tableViewModel addSection:categoriesSection];

 

    self.actions.doneButtonTapped = ^BOOL(SCTableViewController* viewController)

    {

        NSLog(@"doneButtonTapped");

        return TRUE;    // accept the tap

    };

    

}

 

@end

 

 

 


  • vemeutedo likes this

#2 ozie

ozie

    ¯\_(ツ)_/¯

  • STV 5.0 Pro
  • PipPipPipPipPipPipPip
  • 526 posts
  • LocationAustralia
Reputation: 169
Popular

Posted 04 June 2013 - 11:30 PM

hi.. try this

 

- (void)doneButtonAction {
  //what you want to do here
}

P.S. I hate Swift.. don't talk Swift.. Too old school to learn yet another programming language.


#3 dkbowers51163

dkbowers51163

    Starting Out

  • STV 3.0 Std
  • Pip
  • 3 posts
Reputation: 3
Good

Posted 11 June 2013 - 12:51 PM

thank you Ozie.







Also tagged with one or more of these keywords: actions, view-controllers

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users