Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Patr1k

macrumors newbie
Original poster
Jun 9, 2009
12
0
Hi all,

I am new here, I have one question:
If I have created table view and on the top I have navigation controller (and here is button for add row). But my class is uiviewcontroller (because I have tab bar too) and I have no class UITableViewController. So, I dont know, how to write code for the add action.
Here is my code:

@interface SettingsController : UIViewController {

NSMutableArray* clickerList;

IBOutlet UITableView *settingsTableView;
UINavigationController *navController;

}

@property (nonatomic,retain) NSMutableArray* clickerList;
@end

@implementation SettingsController

@synthesize clickerList;
- (void)viewDidLoad {
[super viewDidLoad];

self.navigationItem.title = @"Settings";

self.navigationItem.leftBarButtonItem = self.editButtonItem;

UIBarButtonItem *addButton = [[UIBarButtonItem alloc] initWithTitle:mad:"Add" style:UIBarButtonItemStyleBordered target:self action:mad:selector (add];
self.navigationItem.rightBarButtonItem = addButton;
[addButton release];

self.navigationController.navigationBar.barStyle = UIBarStyleBlackOpaque;
}

- (IBAction)addid)sender
{
//Some code here
}

And then I have created normal tableView (specified its property and so on)

So, please, anyone know, how to do it?
Thank you a lot of
 
Welcome!

First, I'll start by suggesting you enclose code snippets in
HTML:
[code]...[/code]
tags, accessible via the # icon in the toolbar. Makes it easier for us to read (and avoid unintentional smiley translation).

Second, how and where are your tableView datasource and delegate set up?
 
I'm thinking something along the lines of:
Code:
- (IBAction)add:(id)sender
{
        SettingsItem *newItem = [[SettingsItem alloc] init];
	[clickerList addObject:newItem];
        [newItem release];
        [settingsTableView reloadData];
}
 
Oh, Ok, it works. But what to do, if I want add some text to table view?

Thank you

EDIT:
because if I click on the button, new row is added (but with name null), how can i set it?

Thank you
 
Please, Can you show me some code?
I want only put text to new added row... Thank you...
 
Ok, Thank you a lot of...

But I have one last question. Do you know, how to make scroll view, if all I have created in IB?

Thank you
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.