how to draw a text on a circle in SWIFT -
i have no clue how start , not have code. research far pointed out, there no standard functionality , has coded our self ?
any hint or confirmation ?
update using coretextarcview, suggested ashish.
thanks helping. sample project suggested works me. can see blue circle text on it. integrating project, have problems. did following
i added files
"coretextarcview.h"
,"coretextarcview.m"
project. can see them in explorer left.in bridgingheader.h added import :
#import "coretextarcview.h"
i added codesample :
var arctext : coretextarcview = coretextarcview(frame: cgrectmake(50, 50, 200, 200), font: uifont.systemfontofsize(15), text: "hello radious arc text", radius: 85, arcsize: 130.0, color: uicolor.redcolor()) arctext.backgroundcolor = uicolor.clearcolor() self.view.addsubview(arctext)
-> compile errors in coretextarcview.m
:
/users/user/desktop/prototypes/coretextarcview.m /users/user/desktop/prototypes/coretextarcview.m:99:14: 'release' unavailable: not available in automatic reference counting mode /users/user/desktop/prototypes/coretextarcview.m:99:14: arc forbids explicit message send of 'release' /users/user/desktop/prototypes/coretextarcview.m:100:21: 'retain' unavailable: not available in automatic reference counting mode /users/user/desktop/prototypes/coretextarcview.m:100:21: arc forbids explicit message send of 'retain' /users/user/desktop/prototypes/coretextarcview.m:144:33: cast of objective-c pointer type 'nsattributedstring *' c pointer type 'cfattributedstringref' (aka 'const struct __cfattributedstring *') requires bridged cast /users/user/desktop/prototypes/coretextarcview.m:190:63: cast of c pointer type 'ctfontref' (aka 'const struct __ctfont *') objective-c pointer type 'uifont *' requires bridged cast /users/user/desktop/prototypes/coretextarcview.m:298:37: cast of c pointer type 'ctfontref' (aka 'const struct __ctfont *') objective-c pointer type 'id' requires bridged cast /users/user/desktop/prototypes/coretextarcview.m:307:24: 'autorelease' unavailable: not available in automatic reference counting mode /users/user/desktop/prototypes/coretextarcview.m:307:24: arc forbids explicit message send of 'autorelease'
any ?
by using library : https://github.com/javenisme/curvaview
var arctext : coretextarcview = coretextarcview(frame: cgrectmake(50, 50, 200, 200), font: uifont.systemfontofsize(15), text: "hello radious arc text", radius: 85, arcsize: 130.0, color: uicolor.redcolor()) arctext.backgroundcolor = uicolor.clearcolor() self.view.addsubview(arctext)
remove arc 1 file follows (set -fno-objc-arc
library's .m file build phases of project target) :
Comments
Post a Comment