我已经对UitaiteViewCell进行了群,并通过Layoutsubviews方法合并了一些子视图。所有视图均在initWithStyle方法中分配和启动,并在Layoutsubviews方法中设置帧,例如:

initWithStyle:... {
UILabel *myLabel = [[UILabel alloc] initWithFrame:CGRectZero];
myLabel.someProperties = Configured;
[self.contentView addSubview:myLabel];

layoutSubviews {
CGRect labelRect = CGRectMake(10.0f, 5.0f, 35.0f, 180.0f);
myLabel.frame = labelRect;

在ViewController中设置showerAutorAtateRientation将NavigationController,TableView和Uitoolbar旋转适当地旋转,但是TableViewCells的内容不移动。我尚不清楚在自动化masks方面添加的位置或什么。到目前为止,我尝试过的组合尚未做任何事情。有人可以给我一只手吗?

谢谢!

有帮助吗?

解决方案

我想到的答案是使用条件编码在Layoutsubviews方法中放置视图框架,取决于方向

-(void)layoutSubviews {
    //For portrait mode (NOT PORTRAIT UPSIDE DOWN)
    if ( UIDeviceOrientationIsPortrait([[UIDevice currentDevice]orientation]) ) {
        CGRect portraitFrame = CGRectMake(Portrait Frame Coordinates);
        myLabel.frame = portraitFrame;
    } else {
    //For landscape modes
        CGRect landscapeFrame = CGRectMake(landscape frame coordinates);
        myLabel.frame = landscapeFrame;
    }
}

似乎被黑客入侵了

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top