IOS8 issue - UIView drawRect not being called

I have a very simple UIViewone that only draws a triangle. It implements a method UIView drawRectthat draws a figure. It works fine on iOS7, but when I run the same code on iOS8 it is not even called. Any ideas what changed on iOS8? My code in a nutshell:

@interface MyView : UIView
@end

@implementation MyView
- (instancetype)init {
    self = [super init];
    if (self) {
        self.backgroundColor = [UIColor clearColor];
    }
    return self;
}

- (void)drawRect:(CGRect)rect {
    // draw things
}
@end

myView = [MyView new];
[self addSubview:myView];

Update
My view hierarchy:UIViewController View->Custom UILabel->MyView

This is the error message bubble, and in my opinion, it is a beak indicating something.

I used a new tool for debugging the interface, but it is not visible there. The Init method is called, drawRectno. Something must change in iOS8 because iOS7 is calling drawRect.

Update 2
Of course, I use restrictions (and Masonrypod), and that is why I did not specify a frame.

[myView mas_makeConstraints:^(MASConstraintMaker *make) {
    make.top.equalTo(make.superview.mas_bottom);
    make.centerX.equalTo(make.superview);
    make.width.equalTo(@10.0f);
    make.height.equalTo(@5.0f);
}];

[myView setNeedsDisplay] , .

+4
3

. , (Masonry [constraints framework] iOS8 UILabel), . UIView, UILabel, UIView ( ) UIView UILabel . drawRect iOS7, iOS8.

:
UIViewController View->Custom UILabel->MyView

:
UIViewController View->Container UIView->Custom UILabel & MyView

, drawRect iOS8, UIView UILabel , , UIView, UILabel.

+2

. , . initWithRect UIView, /. init, :

myView = [MyView new];
myView.frame = CGRectMake(0.0,0.0,100.0,100.0);
[self addSubview:myView];

(0.0,0.0) 100.0.

, setNeedsDisplay drawRect, :

[myView setNeedsDisplay];
0

make sure the myViewsupervisor property clipToBounds = NOand that myViewrect is on the screen

0
source

All Articles