Brad
Brad

Reputation: 159

IOS UIPicker List going outside Table View Cell?

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.

Upvotes: 5

Views: 146

Answers (3)

Brad
Brad

Reputation: 159

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

Upvotes: 0

Idrees Ashraf
Idrees Ashraf

Reputation: 1383

Are you setting the correct size of UITableViewCell?

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

}

Upvotes: 0

Miknash
Miknash

Reputation: 7948

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.

Upvotes: 0

Related Questions