【问题标题】:Core Plot and Xcode 5 Compile Error: "Implicit conversion from enumeration type 'enum UILineBreakMode'Core Plot 和 Xcode 5 编译错误:“从枚举类型 'enum UILineBreakMode' 隐式转换”
【发布时间】:2013-09-03 15:48:30
【问题描述】:

我正在使用 Xcode 5,但在尝试编译使用 Core Plot 的 iOS 应用程序时出现以下错误:

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

错误在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();
}

我该如何解决这个错误?

【问题讨论】:

    标签: ios objective-c core-plot


    【解决方案1】:

    这已在较新版本的 Core Plot 中得到修复。同时,将违规常量更改为NSLineBreakByWordWrapping

    【讨论】:

      【解决方案2】:

      这应该只是一个警告,除非你打开了-Werror(不是一个坏主意)。无论如何,如果您查看“NSLineBreak”的自动完成功能,错误暗示您应该这样做,您会看到NSLineBreakByWordWrapping

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2013-09-26
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多