12
我創建了一個工具欄程序:如何在工具欄的右側添加按鈕?
UIToolbar *boolbar = [UIToolbar new];
boolbar.barStyle = UIBarStyleDefault;
boolbar.tintColor = [UIColor orangeColor];
[boolbar sizeToFit];
,然後添加一個按鈕,它:
UIBarButtonItem *cancelleftBarButton =[[UIBarButtonItem alloc]initWithTitle:@"OK" style:UIBarButtonItemStyleBordered target:self action:@selector(tapBackGround:)];
cancelleftBarButton.tintColor = [UIColor orangeColor];
NSArray *array = [NSArray arrayWithObjects:cancelleftBarButton, nil];
[boolbar setItems:array animated:YES];
然而,此按鈕僅在工具欄的左側。是否有可能把它放在工具欄的右側?
還可以點擊這些鏈接http://stackoverflow.com/questions/602717/aligning-uitoolbar-items和http://stackoverflow.com/問題/ 6021138 /如何做調整 - uitoolbar - 左 - 右 - 襯墊 – IronManGill