我希望我的 UIButton 始终保持在屏幕底部,而无需一直调整 X。这是我在水平模式下隐藏按钮的代码。
UIImage *greenBtnImage = [[UIImage imageNamed:@"green-btn-iphone.png"]stretchableImageWithLeftCapWidth:5.0 topCapHeight:0.0];
bt = [UIButton buttonWithType:UIButtonTypeCustom];
[bt setBackgroundImage:greenBtnImage forState:UIControlStateNormal];
bt.frame = CGRectMake(14.0f,406.0f,292.0f,41.0f);
[bt addTarget:self action:@selector(didClickButton:)
forControlEvents:UIControlEventTouchUpInside];
[bt setTitle:@"OK" forState:UIControlStateNormal];
bt.autoresizingMask = (UIViewAutoresizingFlexibleWidth);
bt.autoresizesSubviews = YES;
[self.view addSubview:bt];
我很难找到答案如何以编程方式进行。谢谢你。