0

I am trying to make an app with a UIPickerView and UITableView on the same view. I have the PickerView done and it works. But, I can't figure out how to connect the PickerView generated results to the tableView at the bottom of the view. The Picker iterates through user selected variables and I want the tableview to be populated with the results from the picker. Any assistance would be appreciated.

Ms. Ryann
  • 39
  • 1
  • 9
  • I have the UIPicker and UITable working, but need to know how I would get the user generated data to populate the tableview. Right now, I have two separate views working separately but not together. – Ms. Ryann Apr 21 '11 at 02:16
  • When I say that I want to get the "user generated data", I mean I want to pull a new array I made from the values the user picked from the picker. – Ms. Ryann Apr 24 '11 at 18:58

2 Answers2

0

Refer this Links

first add your pickerview then Add UIPickerView & a Button in Action sheet - How?

then in pickerview didSelectrow - Update your content in tableview like lblText.text = [yourArray objectatindex:row] , [self.tableview reloadData];

refer this

http://blog.originalfunction.com/index.php/2010/02/uitableview-uipickerview-with-core-data/

Hope this helps!

Community
  • 1
  • 1
Sukas
  • 267
  • 1
  • 3
  • Sorry. No, it doesn't help. I don't need an UIActionSheet. – Ms. Ryann May 05 '11 at 02:04
  • Also, the UITableView won't even take an array's variables from the viewdidLoad or the loadview methods. I don't know what I am doing wrong, but some assistance would be appreciated! – Ms. Ryann May 05 '11 at 02:07
0

I solved the problem. Thanks to Sukas and many hours of hard work.

How did I add a UITableView to a UIPickerView on the same view.

First I made a UIViewController with no nib. I made the UIPickerView and UITableView programmatically in -(void)loadView.

PickerView and TableView were made into subviews of the UIView.

Important Part: In the DidSelectRow in Component method -- I added [self.table reloadData];

(This is the way I found to get the arrays from my component methods into my tableView methods)

Also, In the DidSelectRow in Component method I removed all objects from the arrays I created to hold the wheel selections. I made two arrays to hold the wheel selections and at different parts of the code I had to removeAllObjects from them, so that I got a new empty array every time the wheel changed and the tableview could be repopulated with new information.

I hope this helps!!!

Ms. Ryann
  • 39
  • 1
  • 9