gpt4 book ai didi

ios - UIButton 不可触摸 - 从 iPhone 4 到 iPhone 5 的自定义

转载 作者:行者123 更新时间:2023-11-28 18:03:45 27 4
gpt4 key购买 nike

我正在开发我的应用程序以使其与 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)];
}

最佳答案

这是因为在 iPhone 5 中,scrollView 的高度更高,并且在您的按钮上方。

因此更改 UIButton 的原点 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)];

希望对你有帮助。

关于ios - UIButton 不可触摸 - 从 iPhone 4 到 iPhone 5 的自定义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16432958/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com