With adapting my app to iOS7 I got the following error when an custom UIView is initialized: Assertion failed: (CGFloatIsValid(x) && CGFloatIsValid(y)),...
.
When the UIView is initialized the drawRect method is called and stops working due to missing datas handled later by another ViewController. The UIView is initialized when the storyboard scene containing the UIView is called.
What is the right way to make sure that the drawRect method is not called right after the initializing.
My UIView drawRect:
method with the line where the error occurs:
- (void)drawRect:(CGRect)dirtyRect{
for (NSInteger i=2; i<=101; i++) {
height = fieldHeight * [[bellCurveArray objectAtIndex:i-1]doubleValue];
CGContextAddLineToPoint(context, x1+t*(i-1), bounds.size.height-y1-height);
//the height is causing the trouble due to the empty bellCurveArray in the early UIView stage
}