0

私はiPhone 5と互換性を持たせるために自分のアプリに取り組んでいます.次のコードでは、donebuttonはiPhone 4で機能しますが、iphone5になるとタッチできません! どうしてか分かりません?

 float screenSizeHeight=[UIScreen mainScreen].bounds.size.height;


if(screenSizeHeight==568)
{
    UIImageView *my_image_view = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Plain_Background2.png"]];
    [my_image_view setFrame:CGRectMake(0,20,320,568)];
    [self.view addSubview:my_image_view];
    [self.view sendSubviewToBack:my_image_view];

    imageScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 20, 320, 460)];
    [doneButtonOutlet setFrame:CGRectMake(124,470,72,28)];
}
if(screenSizeHeight==480)
{
    UIImageView *my_image_view = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Plain_Background.png"]];
    [my_image_view setFrame:CGRectMake(0,20,320,480)];
    [self.view addSubview:my_image_view];
    [self.view sendSubviewToBack:my_image_view];
    imageScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 20, 320, 400)];
    [doneButtonOutlet setFrame:CGRectMake(124,432,72,28)];
}
4

1 に答える 1

9

これは、iPhone 5 では scrollView の高さがより大きく、ボタンの上にあるためです。

そこで、UIButton の origin y を変更します。

    imageScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 20, 320, 460)]; 
// Here imageScrollView bottom is at 480 pixel and doneButtonOutlet origin is at 470 so either small height of scrollview or change button origin y.. 
        [doneButtonOutlet setFrame:CGRectMake(124,470,72,28)];

お役に立てば幸いです。

于 2013-05-08T05:02:26.677 に答える