Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Core Plot and Xcode 5 Compile Error: "Implicit conversion from enumeration type 'enum UILineBreakMode'

I am using Xcode 5 and get the following error when trying to compile my iOS app which uses Core Plot:

Implicit conversion from enumeration type 'enum UILineBreakMode' to different enumeration type 'NSLineBreakMode' (aka 'enum NSLineBreakMode')

The error is in CPTTextStylePlatFormSpecific.m:

-(void)drawInRect:(CGRect)rect withTextStyle:(CPTTextStyle *)style inContext:(CGContextRef)context
{
    if ( style.color == nil ) {
        return;
    }

    CGContextSaveGState(context);
    CGColorRef textColor = style.color.cgColor;

    CGContextSetStrokeColorWithColor(context, textColor);
    CGContextSetFillColorWithColor(context, textColor);

    CPTPushCGContext(context);

    UIFont *theFont = [UIFont fontWithName:style.fontName size:style.fontSize];

    [self drawInRect:rect
            withFont:theFont
       lineBreakMode:**UILineBreakModeWordWrap** // ERROR!!
           alignment:(NSTextAlignment)style.textAlignment];

    CGContextRestoreGState(context);
    CPTPopCGContext();
}

How can I fix this error?

like image 485
AlexR Avatar asked May 17 '26 03:05

AlexR


2 Answers

This is fixed in newer versions of Core Plot. In the meantime, change the offending constant to NSLineBreakByWordWrapping.

like image 192
Eric Skroch Avatar answered May 21 '26 08:05

Eric Skroch


That should only be a warning, unless you've turned on -Werror (not a bad idea). Regardless, if you looked at the autocomplete for "NSLineBreak," which the error implies you should, you would see NSLineBreakByWordWrapping.

like image 27
Kevin Avatar answered May 21 '26 07:05

Kevin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!