简体   繁体   English

苹果手表上画圈的外观不够光滑。 我怎样才能做得更好?

[英]Appearance of drawn circle on the apple watch is not smooth enough. How can I do it better?

One approach I tried is the following:我尝试的一种方法如下:

let circle = Circle.init()
let path = circle.path(in: kServiceRightFrame)
let serviceRightPath = UIBezierPath.init(cgPath: path.cgPath)
serviceRightPath.lineWidth = 2.0
serviceRightPath.fill()
serviceRightPath.stroke()

在此处输入图像描述

I played around with flatness too, but that did not get the job done either.我也玩过平坦度,但这也没有完成工作。 How can a smoother looking circle be drawn programmatically?如何以编程方式绘制更平滑的圆?

EDIT:A more extensive view of my code:编辑:我的代码的更广泛的视图:

 UIGraphicsBeginImageContext(kWatchInterfaceSize)
 let context = UIGraphicsGetCurrentContext()

 //draw service path
 kSBScoreLabelFontColor.setStroke()
 kSBServiceBallColor.setFill()
 ---> code from above
    
 // Convert to UIImage
 let cgimage = context!.makeImage()
    
 //create scoreboardimage
 let scoreBoardImage = UIImage(cgImage: cgimage!)
    
  // End the graphics context'
  UIGraphicsEndImageContext() 

George put me on the right track.乔治让我走上了正轨。 It was a scaling issue.这是一个扩展问题。 The code that I changed was the following:我更改的代码如下:

//Replaced this
//UIGraphicsBeginImageContext(kWatchInterfaceSize) 
//with this
UIGraphicsBeginImageContextWithOptions(kWatchInterfaceSize, 
false, 4.0)

That fixed it.那解决了它。 Now the circle looks a lot smoother in appearance.现在这个圆圈在外观上看起来更平滑了。 在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Swift 1.2:UITableView.reloadData()调用的速度不够快。 滚动之前如何确定数据已加载? - Swift 1.2: UITableView.reloadData() Isn't called quick enough. How can I make sure the data is loaded before I scroll? 如何将带有 transferUserInfo 的字典传输到 Apple Watch? - How do I transfer a dictionary with transferUserInfo to Apple Watch? 如何在Apple Watch上绘制自定义图形? - How can I draw custom graphics on Apple Watch? 如何发送变量和照片以在Apple Watch上显示 - How can I send a variable and a photo to display on Apple Watch 如何创建具有多个 colors 的 Apple Watch 复杂功能? - How can I create a Apple Watch complication that has multi colors? 如何在 Apple Watch iOS 中获得 currentStandHour 值? - How do I get this the currentStandHour value in Apple Watch iOS? 如何在具有特定位置的Apple Watch中打开Maps App? - How do I open the Maps App in Apple Watch with a specific Location? 如何获得REAL Apple Watch打开父应用程序 - How can I get the REAL apple watch to open parent application 如何模拟我的Apple Watch应用程序? -Xcode 6.3 - How can I simulate my Apple Watch app? - Xcode 6.3 如何在 Apple Watch 上以编程方式编写 email? - How can I programmatically compose an email on Apple Watch?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM