I have a view with my UIPicker that will push to my UITableViewController when my start button is pressed.
I want to create a certain number of rows per section in my UITableViewController from my UIPicker.
Here is the relevant code. I'm not getting errors. My UITableViewController just doesn't have any rows in its sections. Any advice or examples on how I could get this to work would be great. Or if someone knows a better way of going about this that would be equally appreciated.
from PushView.m
@interface WorkoutPushViewController ()
{
NSArray *_PickerData;
}
- (void)viewDidLoad {
[super viewDidLoad];
//picker
_PickerData = @[@"1",@"2",@"3",@"4",@"5",@"6",@"7",@"8",@"9",@"10"];
self.setsPicker.dataSource = self;
self.setsPicker.delegate = self;
}
from TableView.h
@interface TableViewController : UITableViewController
@property (nonatomic, retain) PushViewController *pushReference;
@end
from TableView.m
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return ([self.pushReference.setsPicker selectedRowInComponent:0]+1);
// +1 because index 0 is 1 row.
}
Thanks!
As Nitin Gohel said: In your TableView.h
And in your TableView.m
Don't forget to assign the value of number of rows when your start button is tapped.