Rotate a custom UITableViewCell

前端 未结 6 640
有刺的猬
有刺的猬 2020-12-29 14:36

I have a custom UITableViewCell which contains several UIButtons. Each button\'s frame position is relative to the cell width. I set autoresizingMask=UIViewAutoresizingFlexi

6条回答
  •  太阳男子
    2020-12-29 15:17

    After spending hours of research (including posts in this site), I could not find any solutions. But a light bulb turns on all of a sudden. The solution is very simple. Just detect whether the device orientation is landscape or portrait mode and define the ReusableCellIdentifier with a different name for each.

    static NSString*Identifier;
    
    if ([UIDevice currentDevice].orientation!=UIDeviceOrientationLandscapeLeft && [UIDevice currentDevice].orientation!=UIDeviceOrientationLandscapeRight) {
                    Identifier= @"aCell_portrait";
                }
                else Identifier= @"DocumentOptionIdentifier_Landscape";
    
    
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:Identifier];
    

提交回复
热议问题