CCLabelTTF enableStroke doesn't works on IOS 7

It seems CCLabelTTF enableStroke doesn’t work on IOS 7. But it works fine on IOS 6.x (and previous version). Since more and more users have been updated to IOS 7, does anyone know’s how to fix it?

I met the same issue, anyone know how to fix it?

Can anyone help me on this problem? Help!

Same problem here….

hi, where ’s administrator? we all got the issue.

still no any response?!

I met same problem

still no response from administrator ?

Met the same problem.

I have some kind of fix on this.

Go to CCImage.mm, find:

// actually draw the text in the context
// XXX: ios7 casting
[str drawInRect:CGRectMake(textOriginX, textOrigingY, textWidth, textHeight) withFont:font lineBreakMode:NSLineBreakByWordWrapping alignment:(NSTextAlignment)align];

and add the code below:

//New Code Start
        if(pInfo->hasStroke)
        {

            CGContextSetTextDrawingMode(context, kCGTextStroke);
            CGContextSetRGBFillColor(context, pInfo->strokeColorR, pInfo->strokeColorG, pInfo->strokeColorB, 1);
            CGContextSetLineWidth(context, pInfo->strokeSize);
            [str drawInRect:CGRectMake(textOriginX, textOrigingY, textWidth, textHeight) withFont:font lineBreakMode:NSLineBreakByWordWrapping alignment:(NSTextAlignment)align];

        }
        //New Code End

It will redraw stroke with correct color. Tested on 6.1 and 7.0 simulators.

Thank you Artur Bulakaev, It works for me :slight_smile:

Tested on iPad 2 iOS 7.0.4

I tried this code, but the stroke color is always black. Does anybody have a fix for this?

New Label already support stroke. https://github.com/cocos2d/cocos2d-x/pull/5562

@WenHai

This patch is for 3.x version.@Oskard`s patch works for 2.x version.But it is inner stroke.How can it be changed to outer stroke?