在导航栏中使用UIBarButtonSystemItemCompose按钮呈现新视图时,位置略微偏离,并在视图进入视图后进行调整.
我认为这是iOS中的一个错误(使用的是8.3版本).它只在使用UIBarButtonSystemItemCompose时发生.其他类型的按钮(系统,文本或自定义)不会发生这种情况.
复制此错误所需的唯一代码是将此ViewController代码与将进入视图的视图一起使用:
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
UIBarButtonItem* composeBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCamera
target:nil
action:nil];
[self.navigationItem setRightBarButtonItem:composeBarButtonItem animated:YES];
}
@end
Run Code Online (Sandbox Code Playgroud)
我在GitHub上创建了一个存储库,只有最少的代码来重现问题:https://github.com/jvdvleuten/iOSComposeBarButtonItemBug
看起来与此相关:当UINavigationController以模态方式呈现时,UIBarButtonItems移位,除了我的bug只在使用UIBarButtonSystemItemCompose时出现.
有任何想法吗?
objective-c uinavigationcontroller uibarbuttonitem ios uibarbuttonsystemitem
我有一个条形按钮项设置为我的图像资产文件夹中的自定义图像。启动后,一旦用户按下按钮,我希望它更改为系统项 — 停止 ( X
) 按钮。我知道如何以编程方式更改条形按钮的图像,但是如何将图像更改为代码中的系统项之一?
Swift 3,Xcode 8 测试版 1。
如何将我的按钮图像从我的代码更改为这些系统项之一?
我想知道UIBarButtonItem
枚举中的self.toolbarItems
哪个是按钮,哪个是灵活的空间项。