我在viewcontroller中添加了一个名为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中,它将显示为:
但在我的视网膜显示器中,它将显示为:
我尝试过autoresizing Mask。但获得了相同的结果。 如何修复剖面视图的位置?
答案 0 :(得分:1)
我认为你的案例中的问题在于框架的背景图像而不是子视图。如果要为背景图像调整大小,请检查显示背景的UIImageView。使用
计数器检查子视图的帧NSLog(@"Subview Frame = %@",NSStringFromCGRect(subview.frame))
检查视网膜和非视网膜的屏幕尺寸是否相同。即(对于两者都应该是3.5英寸,对于两者都应该是4英寸)。还可以在背景图像视图上自动调整