0

Is it possible to add a uipickerview / uidateview dynamically into a static uitableview?

I basically want the same functionality as the IOS calendar inputs as requested here - iOS Show UIPickerView between UITableViewCells but as I have a static table I don't have any of the available table methods to apply my insertion code to - so I'm struggling!

Community
  • 1
  • 1
Dancer
  • 17,035
  • 38
  • 129
  • 206

2 Answers2

2

Apple sample code Datecell has a perfect example on how to do it.

revolver
  • 2,385
  • 5
  • 24
  • 40
1

To be able to customise the static table view controller dynamically you can overwrite table view delegate methods like this:

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView 
{
    // You can change the number of sections here...
    return [super numberOfSectionsInTableView:tableView];
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    // You can change the number of rows here...
    return [super tableView:tableView numberOfRowsInSection:section];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    // You can change the returning cell of static table view here...
    return [super tableView:tableView cellForRowAtIndexPath:indexPath];
}
voromax
  • 3,369
  • 2
  • 30
  • 53