WKInterfaceGroup bottom corner radius

我只是一个虾纸丫 提交于 2019-12-21 06:09:09

问题


I am trying to set the corner radius for the bottom left and bottom right corners for a WKInterfaceGroup. I was able to set only one single radius value and that would change it for all the corners. I couldn't find a way to access the CALayer to specify it there either.

Is there a way this can be done?

Thanks!

(The group would contain 2 labels and would be in contact with the sash in the dynamic notification interface.)


回答1:


You asked about WKInterfaceGroup, but from your response to @BalestraPatrick it sounds like you are specifically trying to achieve bottom corner rounding in the long-look notification, correct?

If so, it's a bug in the current beta.

Assuming you can sign in, here's a developer forum describing the bug: https://devforums.apple.com/message/1098796

The gist is: there used to be a boolean on the Category (where sash color is) to offset content (that's what Apple's Documentation is referring to here https://developer.apple.com/library/prerelease/ios/documentation/General/Conceptual/WatchKitProgrammingGuide/BasicSupport.html) but they took it out of Beta 5. Now, you are supposed to be able to set the background color of the notification controller itself and it will do the rounding for you. Just doesn't work yet.

I've logged a bug with Apple and had it closed as a "duplicate" - which means it's a bug and they know about it. Feel free to log again - it increases the priority of the bug in their queue :)




回答2:


I hope this answer is what you're looking for.

After thinking about it for some time, I came up with a solution. There is no solution in code. I think this is how Apple is doing the same effect for the calendar notification view.

You need to make the main group's backgroundColor white. Then in the top group set the background color to some other color (like red in my case). Then add another group with the same background color as the container group. The result should be like this in the Apple Watch Simulator.



来源:https://stackoverflow.com/questions/28703352/wkinterfacegroup-bottom-corner-radius

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!