Hi,
I am trying to add custom BarButtonItem on my detailview's navigation bar. but the bar button item is not showing, also the tablemodel's delegate(- (void)tableViewModel:(SCTableViewModel *)tableModel
detailViewWillDismissForRowAtIndexPath:(NSIndexPath *)indexPath) method also not firing.
SCClassDefinition *taskDef = [SCClassDefinition definitionWithClass:[Task class]
propertyNamesString:@"taskText;description;dueDate"];
SCPropertyDefinition *descPropertyDef = [taskDef propertyDefinitionWithName:@"description"];
descPropertyDef.type = SCPropertyTypeTextView;
SCObjectSection *section = [SCObjectSection sectionWithHeaderTitle:nil boundObject:task boundObjectDefinition:taskDef];
[self.tableViewModel addSection:section];
self.tableViewModel.delegate=self;
[self.navigationController.navigationItem setLeftBarButtonItem:nil];
UIBarButtonItem *rightbtn = [[UIBarButtonItem alloc] initWithTitle:@"Add" style:UIBarButtonItemStyleDone target:self action:@selector(addButtonclicked)];
[self.navigationController.navigationItem setRightBarButtonItem:rightbtn];
Thanks,
bala

how to add custom button on navigation bar? and the delegate method is not working
Started by
Balachandhar
, Feb 21 2013 08:44 AM
general actions sections models
5 replies to this topic
#1
Posted 21 February 2013 - 08:44 AM
#2
Posted 21 February 2013 - 07:50 PM
any help?
#3
Posted 22 February 2013 - 11:00 AM
Hi bala,
You should use self.navigationItem instead of self.navigationController.navigationItem.
Please try not to use delegates as they've been deprecated for being too complicated to work with (they're included only for backward compatibility with the old STV 2.0). The recommended way is to use the much more popular "actions" feature instead. In your case, you should be using the sectionActions.detailViewWillDismiss action. For more information, please refer to our eBook chapter titled "Actions".
You should use self.navigationItem instead of self.navigationController.navigationItem.
the tablemodel's delegate(- (void)tableViewModel:(SCTableViewModel *)tableModel
detailViewWillDismissForRowAtIndexPath:(NSIndexPath *)indexPath) method also not firing.
Please try not to use delegates as they've been deprecated for being too complicated to work with (they're included only for backward compatibility with the old STV 2.0). The recommended way is to use the much more popular "actions" feature instead. In your case, you should be using the sectionActions.detailViewWillDismiss action. For more information, please refer to our eBook chapter titled "Actions".
- cometlinear likes this
#4
Posted 23 February 2013 - 01:06 AM
Hi Tarek,
Still I am not getting the button which i included in the code.
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
SCClassDefinition *taskDef = [SCClassDefinition definitionWithClass:[Task class]
propertyNamesString:@"taskText;description;dueDate"];
SCPropertyDefinition *descPropertyDef = [taskDef propertyDefinitionWithName:@"description"];
descPropertyDef.type = SCPropertyTypeTextView;
SCObjectSection *section = [SCObjectSection sectionWithHeaderTitle:nil boundObject:task boundObjectDefinition:taskDef];
[self.tableViewModel addSection:section];
self.tableViewModel.delegate=self;
[self.navigationItem setLeftBarButtonItem:nil];
UIBarButtonItem *rightbtn = [[UIBarButtonItem alloc] initWithTitle:@"Add" style:UIBarButtonItemStyleDone target:self action:@selector(addButtonclicked)];
[self.navigationItem setRightBarButtonItem:rightbtn];
}
Thanks,
bala.
Still I am not getting the button which i included in the code.
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
SCClassDefinition *taskDef = [SCClassDefinition definitionWithClass:[Task class]
propertyNamesString:@"taskText;description;dueDate"];
SCPropertyDefinition *descPropertyDef = [taskDef propertyDefinitionWithName:@"description"];
descPropertyDef.type = SCPropertyTypeTextView;
SCObjectSection *section = [SCObjectSection sectionWithHeaderTitle:nil boundObject:task boundObjectDefinition:taskDef];
[self.tableViewModel addSection:section];
self.tableViewModel.delegate=self;
[self.navigationItem setLeftBarButtonItem:nil];
UIBarButtonItem *rightbtn = [[UIBarButtonItem alloc] initWithTitle:@"Add" style:UIBarButtonItemStyleDone target:self action:@selector(addButtonclicked)];
[self.navigationItem setRightBarButtonItem:rightbtn];
}
Thanks,
bala.
Edited by Balachandhar, 23 February 2013 - 01:12 AM.
#5
Posted 23 February 2013 - 09:55 AM
is it a bug in STV?
#6
Posted 25 February 2013 - 03:00 PM
Hi Bala,
This is not a bug in STV. When I paste your added lines in -viewDidLoad of TasksViewController.m (Core Data App sample), it works as it should by displaying an "Add" button to the right. Here is the code I pasted:
This is not a bug in STV. When I paste your added lines in -viewDidLoad of TasksViewController.m (Core Data App sample), it works as it should by displaying an "Add" button to the right. Here is the code I pasted:
[self.navigationItem setLeftBarButtonItem:nil]; UIBarButtonItem *rightbtn = [[UIBarButtonItem alloc] initWithTitle:@"Add" style:UIBarButtonItemStyleDone target:self action:@selector(addButtonclicked)]; [self.navigationItem setRightBarButtonItem:rightbtn];
Also tagged with one or more of these keywords: general, actions, sections, models
Sensible TableView Forum →
General Discussions →
STV Development statusStarted by sserye , 11 Jun 2017 ![]() |
|
![]()
|
||
Sensible TableView Forum →
STV Sections →
case-insensitive sorting - revisitedStarted by Dennis , 09 Aug 2016 ![]() |
|
![]()
|
||
Sensible TableView Forum →
STV Model →
SCTableModel's boundObject's dealloc method not calledStarted by tommy@ageet , 12 May 2016 ![]() |
|
![]()
|
||
Sensible TableView Forum →
STV Model →
Rearranging the cells of the table and fetching their orderStarted by fabiensen , 27 Apr 2016 ![]() |
|
![]()
|
||
Sensible TableView Forum →
STV Sections →
Update/replace a section's objectStarted by RaduGrama , 13 Mar 2016 ![]() |
|
![]()
|
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users