UIBarButtonItem标题左对齐和右对齐

时间:2017-07-14 13:33:56

标签: objective-c

当我将语言更改为阿拉伯语时,我想将UIBarButtonItem标题更改为左对齐或右对齐。

提前感谢您的帮助。

1 个答案:

答案 0 :(得分:0)

UIToolbar * toolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0,0,0,50)];     toolbar.barStyle = UIBarStyleBlack;

UIBarButtonItem *btdone = [[UIBarButtonItem alloc]initWithTitle:@"Done" style:UIBarButtonItemStyleDone target:self action:@selector(Done)];
UIBarButtonItem *space = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
[toolbar setItems:[NSArray arrayWithObjects:space,btdone, nil]];

Space BarButton提供u空间