我想把UIButton放在多行UILabel的旁邊。以下是我的代碼,iOS6和iOS7 UILable/UIButton有區別嗎?
//ans is Multiline UILabel
NSString * btnTitle = @"Button Title";
UIButton *button = [self linkButtonWithTitle:btnTitle targetAction:@selector(buttonPressed)];
CGSize stringSize = [btnTitle sizeWithFont:[UIFont fontWithName:HELVETICA_NEUE_REGULAR_FONT size:10.f]];
button.frame = CGRectMake(ans.frame.origin.x + 54, ans.frame.origin.y + 28, stringSize.width, stringSize.height);
[self button];
所以我面臨的問題是iOS6和iOS7上的按鈕位置不同。 iOS6似乎是正確的,但iOS7在y軸上的幾點關閉。我注意到的事情是iOS6上的UILabel間距比iOS7上的大。 iOS6和iOS7上的UILabel/UIButton Frame實現是否有區別?
這篇文章可能會有所幫助http://stackoverflow.com/questions/4779221/in-iphone-app-how-to-detect-the-screen-resolution-of-the-device – Caleb