Dancer
Dancer

Reputation: 17681

IOS UIPickerView - add to Static table dynamically

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!

Upvotes: 0

Views: 562

Answers (2)

revolver
revolver

Reputation: 2405

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

Upvotes: 2

voromax
voromax

Reputation: 3389

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];
}

Upvotes: 1

Related Questions