【发布时间】:2013-04-30 14:51:35
【问题描述】:
我在视图控制器中添加了一个名为 LayoutView 的子视图。 LayoutView 然后通过给定的代码添加了一个名为 SectionView 的子视图:
MSSectionView *sec1;
sec1 = [[MSSectionView alloc]initWithFrame:CGRectMake(72, 95,172,145)];
sec1.tag = 1;
sec1.delegate = self;
//sec1.backgroundColor = [UIColor clearColor];
//sec1.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleTopMargin;
[self addSubview:sec1];
在我的普通 iPhone 中,它会显示为:
但在我的视网膜显示器中,它会显示为:
我尝试了自动调整面具的大小。但得到了相同的结果。 如何固定剖面视图的位置?
【问题讨论】:
-
它是哪个设备?即 iPhone 4 或 5
-
第二张图片是iphone 5
-
这样做 if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone && [UIScreen mainScreen].bounds.size.height * [UIScreen mainScreen].scale >= 1136){sec1.frame= CGRectMake(x, y,w,h); }
-
谢谢。单视图会很容易。但是我有很多这样的观点。
-
在这种情况下,您必须使用 leftmarigin,topmarigin,rightmargin,bottommarigins
标签: ios objective-c frame autolayout autoresizingmask