本文介绍了无法在 UIViewController 中为 UIBarButtonItem 创建 IBOutlet的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建一个从 UIBarButtonItem 到 UIViewController 的 IBoutlet,但是当 ctrl+单击并拖动到控制器时,我看不到任何指示器,因此无法创建它.不知道我做错了什么.

I'm trying to create an IBoutlet from a UIBarButtonItem to a UIViewController, but when ctrl+clicking and dragging to the controller, I see no indicator whatsoever, and thus it's impossible to create it. Not sure what I'm doing wrong.

这是屏幕截图,以防万一:

Here's the screenshot, in case it could clear something up:

非常感谢!

我还尝试使用 @property (weak,nonatomic) IBOutlet UIBarButtonItem *barButtonItem; 手动创建 IBOutlet,然后按 ctrl+单击并拖动,但结果相同.

I also tried to create the IBOutlet manually with @property (weak,nonatomic) IBOutlet UIBarButtonItem *barButtonItem; and then ctrl+clicking and dragging, but same result.

推荐答案

我能够创建一个 UIBarButtonItem IBOutlet

I was able to create a UIBarButtonItem IBOutlet

@property (nonatomic, weak) IBOutlet UIBarButtonItem *cameraLibraryToggleButton;

这篇关于无法在 UIViewController 中为 UIBarButtonItem 创建 IBOutlet的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-23 05:22