UIPageControl in a ITableViewCell gets shoved to the top left corner
- by Danny Tuppeny
I'm trying to put a UIPageControl inside a cell (there's nothing else in the cell), but I have two problems:
The dots are aligned at the top-left of the cell, so you only see the bottom-right quarter of the first dot, and the bottom half of the other dots (like the first dots center is 0, 0).
Unless you tab the cell to select it (goes blue), you can't see the dots at all.
Other controls I've put into a cell have filled the whole area as wanted.
How do I tell the UIPageControl to fill the whole cell (and align in the middle)
How do I change the colours so the dots can be seen? I tried calling [pageControl setBackgroundColor] but it didn't seem to do anything.
Here's the code I'm using:
// Create a page control
UIPageControl *pageControl = [[[UIPageControl alloc] init] autorelease];
// Set the number of pages to match the images
[pageControl setNumberOfPages:[imageFilenames count]];
[pageControl setCurrentPage:1];
// Create the cell and add the paging control
UITableViewCell *cell = [self getCell:tableView withIdentifier:@"ImagePager"];
[cell addSubview:pageControl];
//[[cell textLabel] setText:@"ADD PAGING CONTROL"];
return cell;