@IBDesignable error: IB Designables: Failed to update auto layout status: Interface Builder Cocoa Touch Tool crashed

前端 未结 22 2198
终归单人心
终归单人心 2020-12-02 04:45

I have a very simple subclass of UITextView that adds the "Placeholder" functionality that you can find native to the Text Field object. Here is my code for the su

22条回答
  •  隐瞒了意图╮
    2020-12-02 04:51

    In my case, I was doing the next in the initWithFrame/initWithCoder methods to create the view:

    className = NSStringFromClass([self class]);
    self.view = [[[NSBundle mainBundle] loadNibNamed:className owner:self options:nil] firstObject];
    

    It looks like I was Not supposed to use the Main Bundle, but instead the bundle of the class. So I replaced that code for the following and it worked:

    bundle = [NSBundle bundleForClass:[self class]];
    className = NSStringFromClass([self class]);
    self.view = [[bundle loadNibNamed:className owner:self options:nil] firstObject];
    

    I thought maybe this might help somebody.

提交回复
热议问题