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 ?

enter image description here

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

  1. i added files "coretextarcview.h" , "coretextarcview.m" project. can see them in explorer left.

  2. in bridgingheader.h added import : #import "coretextarcview.h"

  3. 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) 

enter image description here

remove arc 1 file follows (set -fno-objc-arc library's .m file build phases of project target) :

enter image description here


Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -