Take the 2-minute tour ×

In my tableview, I have disabled the default scroll in portrait mode. But when the orientation changes to landscape mode, i have enabled the scroll so that I can view the entire content of the table. But, a white space is visible before and after the tableview cells, when scrolled. So, can anyone tell me how to remove this white space in the default scrollview of the table in landscape mode? I've tried using the autoresizingmask, as well as tried to set the content size of the table according to the landscape mode. Both didn't work and this is my code so far.

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation


    // Return YES for supported orientations

    return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);


-(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {

if((self.interfaceOrientation == UIDeviceOrientationLandscapeLeft) || (self.interfaceOrientation == UIDeviceOrientationLandscapeRight)){

        self.tableView.scrollEnabled = YES;

        self.tableView.sectionIndexMinimumDisplayRowCount =5;

       self.tableView.contentSize = CGSizeMake(480, 320);

        self.tableView.autoresizingMask = YES;

       //CGFloat cellHeight;}

    else if((self.interfaceOrientation == UIDeviceOrientationPortrait) || (self.interfaceOrientation == UIDeviceOrientationPortraitUpsideDown)){

        self.tableView.scrollEnabled = NO;

share|improve this question
have to tried to make the background color of the tableview as clearcolor ? –  IronManGill Jan 24 '13 at 8:30

2 Answers 2

up vote 5 down vote accepted

Try this in didRotateFromInterfaceOrientation method,

[self.tableView setBounces: NO];

It stops the scroll from bouncing and will remove the white space.

share|improve this answer
Worked like a gem..thanx a ton... –  Umesh Kumar Jan 24 '13 at 9:03

set cell seperator to none & make background color as clearColor.be sure that scrollView style is set to Default.

share|improve this answer
Got it working by the above answer. If i set it to clearcolor, it makes the white space to be black. What i wanted was to remove the space, whichever color it might be. Anyway thanks for ur answer. –  Umesh Kumar Jan 24 '13 at 9:04
@UmeshKumar clearColor is different than blackColor –  Ravindra Bagale Jan 24 '13 at 9:11

Your Answer


