0

I am very new to IOS development and Objective-C as i have just come from a mostly Java background. I have quite frankly searched everywhere on the web to find the answer to my question but nobody as it seems can give a clear concise answer on how to do this so anything would be VERY much appreciated!

So here is what i am trying to do. I have a UITableView and a UIToolBar below it with a UIBarButtonItem. What i want to do is be able to press the BarButtonItem and then have a new TableViewCell with a text field in it be created and placed at the top of the TableView that has a unique tag so that i can parse through the text fields later and retrieve the text to store into a mutable array.

Any help would be really awesome so thank you in advance, i would really like to get this working! If you have any questions on the code i have or more details on what i am asking please ask away!

rishi
  • 11,779
  • 4
  • 40
  • 59
reisw
  • 1
  • You can create an data array/dictionary in starting of app from where your table view loads, now on click of tab bar item you can update your array/dictionary and can call reload data of table view. What ever you have changed in your data will reflect in table. – rishi Jun 27 '12 at 06:37

2 Answers2

0

Well there are plenty of resources on how to add TableViews, Toolbars, etc... Here's an overview of what you'll want to do.

In your ViewController's view, add a UITableView to it, but remember you want to leave space in your ViewController's view for the toolbar at the bottom of the screen. So set the tableView.frame accordingly.

Look up how to add a UIToolbar (http://stackoverflow.com/a/7712240/1457445 is a good start) Then how to add a UIBarButtonItem (http://stackoverflow.com/questions/5383906/how-to-add-uibarbuttonitem-in-uitoolbar-in-code)

As for adding the textView in the UITableViewCell, you simply call [tableView.contentView addSubview:yourTextView]; Again, there is plenty of help out there for customizing UITableViewCells (http://stackoverflow.com/questions/4238760/how-to-make-a-uitableviewcell-with-a-uitextview-inside-that-dynamically-adjust)

And to top it off, you'll need to figure out how to add the textview cell to the table - another great SO post (http://stackoverflow.com/questions/5824998/uitableview-adding-cells-dynamically)

Kpmurphy91
  • 554
  • 5
  • 15
0

The simplest way is put your UITextField on UITableView header when UIToolbar button item touched. The simplest way is put your UITextField on UITableView header when UIToolbar button item touched. After user done on UITextField then update your NSMutableArray reload data of UITableView and remove header on UITableView.

Atif
  • 1,220
  • 11
  • 16