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

标签 ios xcode uiview uitabbarcontroller iboutlet

今天有一个疯狂的问题。我创建了一个 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/

相关文章:

ios - 如果按下 UIButton,手势不会触发

iphone - UITabBar 识别纵向或横向方向

cocoa - UIView绘制矩形;类变量超出范围

swift - 用按钮圈住 UIView 以使其颜色随机化

ios - 如何在自定义 View 类中动态替换自定义 subview ?

ios - 如何从对象数组中创建 IBOutlets?

ios - 为当前用户调用 Parse Cloud Function

objective-c - fetchRequestFromTemplateWithName 返回 nil

ios - 以编程方式使用自动布局添加多个按钮以使用 X、Y、填充约束进行查看

swift - 使用 segue [Swift 3.0 Xcode] 通过多个 View Controller 传递数据