gpt4 book ai didi

iphone - UIBarButtonSystemItemCamera 不以 UIToolBar 为中心

转载 作者:行者123 更新时间:2023-11-29 11:18:00 26 4
gpt4 key购买 nike

我这里有非常简单的代码

[mImagePickerToolBar setBarStyle:UIBarStyleBlackTranslucent];
[mImagePickerToolBar sizeToFit];
UIBarButtonItem *spaceItem1 = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
UIBarButtonItem *spaceItem2 = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];

UIBarButtonItem *cameraItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCamera target:self action:@selector(captureBarItemPressed:)];

NSArray *items = [NSArray arrayWithObjects: spaceItem1, cameraItem, spaceItem2, nil];

[mImagePickerToolBar setItems:items animated:NO];

我的 UIToolBar 相机项目根本没有居中,看图片,与主页按钮相比它有点正确,为什么会这样以及如何居中?

enter image description here

最佳答案

灵活空间应该起作用。在我看来,这是 iOS 中的一个错误。您可以通过在界面生成器中对此进行模拟来亲眼看到。

这是带边框的按钮:

enter image description here

这是普通按钮:

enter image description here

它甚至没有在自己的选择区域内排列。

关于iphone - UIBarButtonSystemItemCamera 不以 UIToolBar 为中心,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8601116/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com