質問

I added a subview named LayoutView in my viewcontroller. LayoutView then added a subview named SectionView by the given code:

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];

In my normal iphone it will display as:

normal iphone

But In my retina display it will display as:

enter image description here

I tried autoresizing Mask. but the same result obtained. How can i fixed the section view's position ?

役に立ちましたか?

解決

I think the problem in your case resides in background image of frame rather the subview . Check the UIImageView displaying your background if it is resizing for background image . Counter check the frame of the Subview by using

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

check that the screen sizes for both retina and non-retina is same . i.e. (either is should be 3.5 inches for both OR it should be 4 inches for both). Also appliy autoresizing on your background imageview

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top