我不知道如何开始,所以我也没有任何代码。 到目前为止,我的研究指出,没有标准功能,这必须由我们自己编码?
任何提示或确认?
使用由Ashish建议的CoreTextArcView
更新。
感谢您的帮助。 建议的示例项目对我有用。我可以看到带有文字的蓝色圆圈。 但是通过将其集成到我的项目中,我遇到了问题。 我做了以下
我将文件"CoreTextArcView.h"
和"CoreTextArcView.m"
添加到我的项目中。我可以在左边的资源管理器中看到它们。
在我的BridgingHeader.h中,我添加了导入:#import "CoreTextArcView.h"
我添加了Codesample:
var arctext:CoreTextArcView = CoreTextArcView(frame:CGRectMake(50,50,200,200),font:UIFont.systemFontOfSize(15),text:“Hello this is radious arc with text”,radius:85,arcSize: 130.0,颜色:UIColor.redColor()) arctext.backgroundColor = UIColor.clearColor() self.view.addSubview(arctext)
- >我在CoreTextArcView.m
中遇到了编译错误:
/Users/user/Desktop/Prototypes/CoreTextArcView.m
/Users/user/Desktop/Prototypes/CoreTextArcView.m:99:14: 'release' is 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' is 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 *' to C pointer type 'CFAttributedStringRef' (aka 'const struct __CFAttributedString *') requires a bridged cast
/Users/user/Desktop/Prototypes/CoreTextArcView.m:190:63: Cast of C pointer type 'CTFontRef' (aka 'const struct __CTFont *') to Objective-C pointer type 'UIFont *' requires a bridged cast
/Users/user/Desktop/Prototypes/CoreTextArcView.m:298:37: Cast of C pointer type 'CTFontRef' (aka 'const struct __CTFont *') to Objective-C pointer type 'id' requires a bridged cast
/Users/user/Desktop/Prototypes/CoreTextArcView.m:307:24: 'autorelease' is unavailable: not available in automatic reference counting mode
/Users/user/Desktop/Prototypes/CoreTextArcView.m:307:24: ARC forbids explicit message send of 'autorelease'
任何帮助?
答案 0 :(得分:2)
使用此库:https://github.com/javenisme/CurvaView
var arctext : CoreTextArcView = CoreTextArcView(frame: CGRectMake(50, 50, 200, 200), font: UIFont.systemFontOfSize(15), text: "Hello this is radious arc with text", radius: 85, arcSize: 130.0, color: UIColor.redColor())
arctext.backgroundColor = UIColor.clearColor()
self.view.addSubview(arctext)
删除一个文件的弧,如下所示(从项目目标的构建阶段将-fno-objc-arc
设置为该库的.m文件):