gpt4 book ai didi

ios - UIView 子类认为它是一个 UITabBarController

转载 作者:行者123 更新时间:2023-11-29 12:37:44 24 4
gpt4 key购买 nike

今天有一个疯狂的问题。我创建了一个 UIView 子类:

@interface MyNavBar : UIView

@property (nonatomic, weak) IBOutlet UILabel *titleLabel;

- (void)updateTitle:(NSString*)title;

@end

如果我将光标放在“MyNavBar”文本中,我会在帮助 View 中看到:

UITabBarController manages a button bar and transition view, for an application with multiple top-level modes....

什么?

更糟糕的是,我在 Storyboard 中创建了一个 UIView 并将其指定为 MyNavBar 类。我创建了一个 UILabel 作为 subview ,但我无法将其拖动以将其连接为 titleLabel。也无法通过从 IB 拖拽在界面中创建新的 IBOutlet。

在这个过程中,我没有做任何与 UITabBarController 有关的事情。这里会发生什么?

我正在运行 Xcode 6 GM。

最佳答案

(这与其说是一个更新,不如说是一个真正的答案)

这可能是 Swift 类信息生成方式的问题。在 Xcode 7.2 中,我只是在 UIImage 函数上使用了“跳转到定义”。类声明的正上方是一个与 UITabBarController.h 中相同的注释 block 。 (我将整个 block 放在搜索字段中,它找到了 UITabBarController.h。)

在搜索中找到这篇文章后,我为 UIView 选中了“跳转到定义”。这个 block 仍然在 UIView 的定义之上。

/*!
UITabBarController manages a button bar and transition view, for an application with multiple top-level modes.

To use in your application, add its view to the view hierarchy, then add top-level view controllers in order.
Most clients will not need to subclass UITabBarController.

If more than five view controllers are added to a tab bar controller, only the first four will display.
The rest will be accessible under an automatically generated More item.

UITabBarController is rotatable if all of its view controllers are rotatable.
*/
@available(iOS 2.0, *)
public class UIImage : NSObject, NSSecureCoding {

关于ios - UIView 子类认为它是一个 UITabBarController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25816182/

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