繁体   English   中英

在纵向和横向中设置UIView位置

[英]Set UIView position in portrait and landscape

我已经创建了一个加载器视图,并使用以下代码设置了指示器的位置:

    loadingView = [[UIView alloc]initWithFrame:CGRectMake(455, 225, 80, 80)]

如何为人像模式设置其他位置? 谢谢

if([UIApplication sharedApplication].statusBarOrientation == UIInterfaceOrientationPortrait)
{
//portrait
loadingView = [[UIView alloc]initWithFrame:CGRectMake(225, 455, 80, 80)];//any position you want
}
else
{
//landscape
loadingView = [[UIView alloc]initWithFrame:CGRectMake(455, 225, 80, 80)];//any position you want
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM