gpt4 book ai didi

iphone - 支持横向一圈UIVIEWS :

转载 作者:行者123 更新时间:2023-12-03 21:15:30 26 4
gpt4 key购买 nike

尝试支持横向,以下是绘图代码。注意:aCell 是 UIControl 类的对象:-

- (void)layoutCells 
{
for ( UIView *aCell in _cells ){
if ( [aCell superview] != self )
[self addSubview:aCell];

int height = [[UIScreen mainScreen] bounds].size.height;
if (height >= 568)// iPHone 5
{
CGRect cellFrame = aCell.frame;
cellFrame.size.height = 520;
[aCell setFrame:cellFrame];

[aCell setCenter:_spinCenter];
[[aCell layer] setAnchorPoint:CGPointMake( 0.5, (_spinCenter.y/(self.frame.size.height+70)))];
}

else{
[aCell setCenter:_spinCenter];
CGRect frame = CGRectMake(60.f, 424.f, 200.f, 460);
[[aCell layer] setAnchorPoint:CGPointMake( 0.5, _spinCenter.y/frame.size.height )];
}
// Clockifying happens with "selectCellAtIndex:animated:".
}
}

最佳答案

您需要做的就是支持 View Controller 中的旋转,该 View Controller 包含您添加单元格的 View (示例中为 self )。

此外,请注意,在横向(如果您的 View 支持旋转)窗口高度等于 View 宽度(如果在全屏模式下)。
因此,您必须重新考虑下一行:

cellFrame.size.height = 520;

如果是横向,则应更改宽度而不是高度...

关于iphone - 支持横向一圈UIVIEWS :,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16441152/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com