草庐IT

Hierarchy

全部标签

ios - swift : "Attempt to present UIAlertController whose view is not in the window hierarchy!"

我试图在单击按钮时显示UIAlertController(按钮单击运行特定代码,并根据所述结果显示警报)。初始ViewController是默认的,我创建了第二个(ConsoleViewController)。用户登录,并在成功登录后转到下一个View(ConsoleViewController),该View显示数据(位于ConsoleViewController的viewDidLoad()部分)。用户点击“签到”后,应用程序会捕获设备的GPS位置、当前日期/时间,并打开相机拍摄(自拍)照片。在相机中选择“使用照片”(尚未对该功能进行编码)后,它将所有3个参数发送到API处理程序。第二

ios - 警告 : Attempt to present UIAlertController on UISplitViewController whose view is not in the window hierarchy

这个问题在这里已经有了答案:HowtopresentUIAlertControllerwhennotinaviewcontroller?(39个答案)关闭5年前。大多数与此问题类似的问题是present在viewDidAppear之前被调用。这不是这里的原因。此应用不使用NIB的Storyboard,所有操作都是程序化的。应用程序窗口的rootViewController是一个UISplitViewController。SplitView的ViewController设置为两个UINavigationController的数组。一个subviewController然后模态地呈现一个V

ios - "The view hierarchy is not prepared for the constraint" swift 3 错误

我正在尝试添加一个按钮并以编程方式设置约束,但我一直收到此错误并且无法弄清楚我的代码有什么问题。我已经查看了此处的其他问题,但它们对我的情况帮助不大。btn.setTitle("mybtn",for:.normal)btn.setTitleColor(UIColor.blue,for:.normal)btn.backgroundColor=UIColor.lightGrayview.addSubview(btn)btn.translatesAutoresizingMaskIntoConstraints=falseletleft=NSLayoutConstraint(item:btn,a

swift - WatchOS 警告 : rejected resignFirstResponder when being removed from hierarchy

我在Xcode中遇到这个错误。2018-02-2607:13:22.326888-0500WatchExtension[1298:2691330][View]Firstresponderwarning:';layer=>'rejectedresignFirstResponderwhenbeingremovedfromhierarchy我的InterfaceController有4WkInterfacePickers,这个错误似乎与显示警报(当用户保存数据时)有关,但我不确定。有没有人见过这个?我的代码:ifsuccessSaving==true{DispatchQueue.main.a

android - 从android中的上下文获取 Activity

这个让我难过。我需要从自定义布局类中调用Activity方法。这样做的问题是我不知道如何从布局中访问Activity。个人资料ViewpublicclassProfileViewextendsLinearLayout{TextViewprofileTitleTextView;ImageViewprofileScreenImageButton;booleanisEmpty;ProfileDatadata;Stringname;publicProfileView(Contextcontext,AttributeSetattrs,Stringname,finalProfileDataprof

android - 从android中的上下文获取 Activity

这个让我难过。我需要从自定义布局类中调用Activity方法。这样做的问题是我不知道如何从布局中访问Activity。个人资料ViewpublicclassProfileViewextendsLinearLayout{TextViewprofileTitleTextView;ImageViewprofileScreenImageButton;booleanisEmpty;ProfileDatadata;Stringname;publicProfileView(Contextcontext,AttributeSetattrs,Stringname,finalProfileDataprof

iphone - 警告: Attempt to present ViewController on ViewController whose view is not in the window hierarchy

我已经看过相关的问题,但是没有任何问题可以解决我的问题。我正在尝试连续使用dismissViewControllerAnimated:animated:completion和presentViewControllerAnimated:animated:completion。使用Storyboard,我通过部分curl动画模态呈现InfoController。部分curl在InfoController上显示了一个我想启动MFMailComposeViewController的按钮。因为部分curl部分隐藏了MFMailComposeViewController,所以我首先要通过取消部分c

ios - 安装Xcode 5.1后报错: Two views in the same hierarchy have the same restoration identifier

当我使用Xcode5.1打开我的项目时,我现在遇到了这个错误,以前没有出现过。Twoviewsinthesamehierarchyhavethesamerestorationidentifier我尝试更改ID,但并没有消除错误。我还尝试清理我的构建并删除我的派生数据。 最佳答案 我遇到了同样的问题,我通过删除恢复ID解决了这个问题。如果其他人遇到此问题,请选择错误以找出导致问题的Storyboard上的哪个View。选择View后(对我来说,它是UITableView中的四个可重用单元格)选择身份检查器。它是“实用工具”面板上从左数

ios - 警告 : Attempt to present whose view is not in the window hierarchy! 使用已识别的 segue 时

我知道还有很多其他问题与此有关,但它们并没有完全解释我的问题。我从我的初始ViewControllerSAGViewController转到另一个SAGHomeScreenViewController通过一个确定的Storyboard自定义segue,当相关按钮被按下时:-(IBAction)goNewGame{[selfperformSegueWithIdentifier:@"startHomeSegue"sender:self];}它工作正常但我仍然收到警告:Warning:AttempttopresentSAGHomeScreenViewController:0xc43b800o

ios - 警告 : attempt to present ViewController whose view is not in the window hierarchy

在我的一个应用程序中,我从applicationdidReceiveLocalNotification方法调用viewController。页面加载成功,但显示警告:Warning:Attempttopresentonwhoseviewisnotinthewindowhierarchy!我的代码如下:-(void)application:(UIApplication*)applicationdidReceiveLocalNotification:(UILocalNotification*)notification{blankPageViewController*myView=[[bla