Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7503063
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T21:05:34+00:00 2026-05-29T21:05:34+00:00

As a little background, im building a rotated UITableView as a sort of sideways

  • 0

As a little background, im building a rotated UITableView as a sort of sideways “picker” view. To do this, im taking a UITableView, appling a rotation transform to it, and then rotating again the UITableViewCells inside the tableview.

The problem im having is that some of the table cells become “misaligned” – their frame gets drawn at a certain distant offset (in both the x and y dimension) from the other table cells.

I’ve narrowed down that this bug occurs on the first table cell completely out of the visible tableview rect after a [tableView reloadData] call is made. (i.e. if I have 4 table cells, A which is completely visible and drawn, B which is half on/half off the view, and C and D which are completely off the screen and not yet rendered, when i scroll to C it is bugged, but when i scroll to D, it is not).

Now for some code –

the containing view’s init

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        ...
        self.tableView = [[UITableView alloc] init];
        [self addSubview:_tableView];
        [_tableView setDelegate:self];
        [_tableView setShowsVerticalScrollIndicator:NO];
        [_tableView setSeparatorStyle:UITableViewCellSeparatorStyleNone];
        CGAffineTransform transform = CGAffineTransformMakeRotation(-1.5707963);    
        _tableView.transform = transform;
        _tableView.frame = self.bounds;
        ...
    }
    return self;
}

the relevant delegate methods

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath 
{
    return [tableView.dataSource tableView:tableView cellForRowAtIndexPath:indexPath].frame.size.height;
}

- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{ 
    CGAffineTransform transform = CGAffineTransformMakeRotation(1.5707963);
    cell.transform = transform;
}

the table cell’s layoutSubviews
edit: I manually set the size of the cell (mainly the width) based on the length on the content of the cell

- (void)layoutSubviews {
    [super layoutSubviews];

    // some calculations and sizing of subviews

    // height and width are swapped here, because the table cell will be rotated.
    self.frame = (CGRect){self.frame.origin.x,self.frame.origin.y,calculatedHeight,calculatedWidth};
}

It would seem that the bugged tablecell’s frame.origin is set incorrectly when it reaches layout subviews. Setting the frame’s origin.x value to 0 fixes the x dimension offset problem, but obviously I can’t do the same for the y dimension because this value determines the cell’s position in the tableview.

Please let me know if there’s some crucial info I might be leaving out. Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T21:05:35+00:00Added an answer on May 29, 2026 at 9:05 pm

    Good news – after spending many many previous hours trying to figure this out, I just stumbled upon the solution.

    This code was getting called multiple times for the ‘bugged’ cell, and apparently due to some intricacies of CALayer and CGAffineTranform’s, assigning the tranform had an additive affect.

    - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
    { 
        CGAffineTransform transform = CGAffineTransformMakeRotation(1.5707963);
        cell.transform = transform;
    }
    

    The solution was to move the transform into the cell’s init method, so that it is guaranteed to be set only once per cell.

    // ... init stuff  
    self.transform = CGAffineTranformMakeRotation(1.5707963);
    // ... more init stuff
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First a little background. I am building a mobile app for a client, this
Little background, the table view is filled by a fetchedResultsController which fills the table
A little background: We're building a library/framework for working with scientific models. We have
I want this to be a background in my app for Ipad. I'm building
Little background: this is an absolute beginner's website. I am a Film major haha
A little background first as to why I need this. I am currently creating
Little Background: I have csv file which has lots of rows and each row
A little background: I have a perl script which is performing a number of
A little background: I am loading a WPF UI from a database which is
A little background first. I've been tasked with encrypting files with a Powershell script

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.