Iphone UI按钮的对齐

Iphone UI按钮的对齐,iphone,uibutton,Iphone,Uibutton,我正在开发一个简单的应用程序,其中包含两个选项卡,其中的按钮与它们一起导航。因为我是iphone编程新手,所以无法将按钮与所需位置对齐。在搜索谷歌时,我得到了一些代码,这些代码已经包含在我的代码中。我附上代码 -(void)viewDidLoad { [super viewDidLoad]; UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect]; [button addTarget:self action:@se

我正在开发一个简单的应用程序,其中包含两个选项卡,其中的按钮与它们一起导航。因为我是iphone编程新手,所以无法将按钮与所需位置对齐。在搜索谷歌时,我得到了一些代码,这些代码已经包含在我的代码中。我附上代码

-(void)viewDidLoad
{
[super viewDidLoad];
UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[button addTarget:self action:@selector(method)forControlEvents:UIControlEventTouchDown];
[button setTitle:@"forward" forState:UIControlStateNormal];
button.frame = CGRectMake(60, 70, 70, 60);
[self.view addSubview:button];
button.titleLabel.textColor = [UIColor redColor];
button.titleLabel.textAlignment = UITextAlignmentRight; //IT IS NOT WORKING
// button.titleLabel.font = [UIFont boldSystemFontOfSize:FONT_SIZE];
//[button setTitle:fromButton.titleLabel.text forState:UI
// Do any additional setup after loading the view, typically from a nib. 
}
因为我已经按此代码将按钮向右对齐,但它处于默认位置。没有变化。 请引导我。 提前感谢

试试这个:

button.contentHorizontalAlignment = UIControlContentHorizontalAlignmentRight;
CGRectMake(x、y、宽度、高度)


你玩过了吗?

它正在将按钮上显示的内容向右对齐。我希望按钮向右对齐。这样做了,但我想将按钮向左、向右或屏幕底部对齐,请告诉我怎么做
button.frame = CGRectMake(120, 70, 70, 60);