gpt4 book ai didi

ios - 如何快速从 Apple Watch/WatchKit 的 super View 中删除 View

转载 作者:行者123 更新时间:2023-11-30 14:09:18 26 4
gpt4 key购买 nike

在android中使用相同的可见性函数,例如

1) android:visibility="gone" // used to hide the control and as well as space
(or)
CONTROLNAME.setVisibility(View.GONE);
2) android:visibility="invisible" // used to hide the control but it will take space
(or)
CONTROLNAME.setVisibility(View.INVISIBLE);

在这个 question 中对于苹果 watch 应用程序

我尝试过下面的代码

splashscreenImage.removeFromSuperView()

[self.splashscreenImage addConstraint:[NSLayoutConstraint constraintWithItem:self.captchaView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:0]];

还有

[splashscreenImage removeFromSuperview]

以上都不对我有用。请告诉我从 WKInterfaceController 扩展的类的 super 中删除 View 的代码。

谢谢。

最佳答案

在 WatchKit 中,您无法以编程方式删除对象。

您可以使用setHidden:属性

Hides or shows the interface object in your user interface.

func setHidden(_ hidden: Bool)

A Boolean value indicating the visibility of the object. Specify true to hide the object. Specify false to show it.

Discussion

When you hide or show an object in your interface, WatchKit makes a note to update the layout during the next refresh cycle. During that cycle, WatchKit adjusts the layout to display only the currently visible objects.

引用问题:

Can I create a WatchKit app without a storyboard (entirely in code)?

Create imageView programmatically in Watch Kit

关于ios - 如何快速从 Apple Watch/WatchKit 的 super View 中删除 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31941571/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com