如果图像的高度大于412但是它没有工作,我试图让我的图像内的按钮移动到x = 160和y = 468。我试图解决这个问题进行自动布局,但是到现在为止我似乎很难。任何人都可以帮助我或给我一个解决这个问题的最佳方法吗?
我的.m文件的一部分:
@interface welcomeViewController ()
@end
@implementation welcomeViewController
@synthesize imgWelcome;
@synthesize btnPedir;
- (void)viewDidLoad
{
[super viewDidLoad];
[self btnLayout];
}
- (void)btnLayout
{
if (imgWelcome.frame.size.height > 412) {
CGRect rect = self.btnPedir.frame;
rect.origin.x = 160;
rect.origin.y = 468;
self.btnPedir.frame = rect;
}
}
@end
imgWelcome =按钮在里面的图像
btnPedir =按钮
答案 0 :(得分:0)
这里你的按钮y位置从468开始,你还没有提到它的高度。我的假设是你的按钮框架超出你的超视图框架。