5

Hey so i have implemented a UIPicker within a Table Cell, but when viewed within a iPhone the Picker list goes outside its dedicated cell. Is there anyway to prevent this from happening and make the UI Picker stay within its own cell instead of overlaying to the next cell.

enter image description here

Am trying to stop the green from overlaying onto the next cell. When scrolling up it hides it from the top cell just not the bottom cell.

rmaddy
  • 314,917
  • 42
  • 532
  • 579
Brad
  • 159
  • 11

3 Answers3

0

The problem is that you have element which height exceeds cells height.

Solution one: change height for the cell in cellForRowAtIndexPath so it is over the next cell.

Solution two: Try to change zPosition on layer for cells below so you ensure that it is on the top and "hides" the rest of the UIPicker.

Solution three: Resize UIPicker so it fits inside the cell.

Solution four: Set clipsToBounds to true.

Miknash
  • 7,888
  • 3
  • 34
  • 46
0

Are you setting the correct size of UITableViewCell?

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath;
{
    return cellContentHeight;

}
Idrees Ashraf
  • 1,363
  • 21
  • 38
0

Hello apparently UI Pickers only conform to certain sizes so attempting to resize them will only assign them to default size that are closest.

https://stackoverflow.com/a/12473679/4697460

Community
  • 1
  • 1
Brad
  • 159
  • 11