Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios UIView视网膜显示的位置变化_Ios_Objective C_Frame_Autolayout_Autoresizingmask - Fatal编程技术网

Ios UIView视网膜显示的位置变化

Ios UIView视网膜显示的位置变化,ios,objective-c,frame,autolayout,autoresizingmask,Ios,Objective C,Frame,Autolayout,Autoresizingmask,我在viewcontroller中添加了一个名为LayoutView的子视图。LayoutView然后根据给定代码添加了名为SectionView的子视图: MSSectionView *sec1; sec1 = [[MSSectionView alloc]initWithFrame:CGRectMake(72, 95,172,145)]; sec1.tag = 1; sec1.delegate = self;

我在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中,它将显示为:

但在我的视网膜显示器中,它将显示为:

我试过自动调整面具的尺寸。但也得到了同样的结果。
如何固定剖面视图的位置?

我认为您的问题在于帧的背景图像,而不是子视图。如果正在调整背景图像的大小,请检查显示背景的UIImageView。使用计数器检查子视图的框架

NSLog(@"Subview Frame = %@",NSStringFromCGRect(subview.frame)) 

检查视网膜和非视网膜的屏幕尺寸是否相同。i、 e.(两者中的一个应为3.5英寸,或者两个都应为4英寸)。还可以在背景图像视图上应用自动调整大小功能它是哪个设备?i、 iPhone 4或5秒图像是iPhone 5如果(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谢谢。我没有在根viewcontroller中应用自动调整大小。这就是自动调整大小不能正常工作的原因。