本文介绍了如何使用InterfaceBuilder在iOS Watch Kit中重叠两个控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个带有图像的按钮,我想将一个按钮重叠在另一个按钮上. iOS Watch甚至可以做到吗?而且,如何像常规iOS编程一样在手表编程中处理sendViewtoBackground或BringSubViewtoFront等WKInterfaceObject的背景或前景深度?

I have two button with images and i want to overlap one over another. Is it even possible to do it iOS Watch?Moreover, how to handle background or foreground depth of a WKInterfaceObject in watch programming, like sendViewtoBackground or bringSubViewtoFront, as in normal iOS programming ?

推荐答案

在手表中,您没有Z层次结构.

In the watch you don't have a Z hierarchy.

您最多可以使用一个有背景的组,然后对该背景进行控制.

The max you can do is using a group, that has a background and then have controls over that background.

另一种替代方法(hack?)是将所有层次结构呈现到UIImage中,并在手表中进行设置.

Another alternative (hack?) is to render all your hierarchy into an UIImage and set it in the watch.

这篇关于如何使用InterfaceBuilder在iOS Watch Kit中重叠两个控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-14 01:19