草庐IT

orientation-changes

全部标签

ios - UIDatePicker的Value Changed事件在第一次改变值时不触发

这个问题在这里已经有了答案:UIDatePickerbug?UIControlEventValueChangedafterhittingminimuminternal(7个答案)关闭7年前。我使用Swift开发一个iOS应用。我在Storyboard上有一个文本字段,需要将UIDatePicker设置为其输入View。以下是我的代码。@IBOutletvartextField:UITextField!overridefuncviewDidLoad(){super.viewDidLoad()vardatePicker:UIDatePicker=UIDatePicker()datePick

ios - 在生产环境中使用 Realm Collection Change 通知

Fromthedocs,我正在使用类似于根据模型更改动态更新TableView的方法:letresults=realm.objects(Message).filter("someQuery=='something'").sorted("timeStamp",ascending:true)//ObserveResultsNotificationsnotificationToken=results.addNotificationBlock{[weakself](changes:RealmCollectionChange)inguardlettableView=self?.tableView

iOS : UIView with subview Button click event not firing when zPosition of view changes

我在我的应用程序中使用父ViewController和subviewController。其中父ViewController包含subview作为zPosition值为2的按钮。现在,我将subviewController添加到父ViewController,如下所示,funcaddChildViewController(){letstoryboard=UIStoryboard(name:"myStoryBoard",bundle:nil)letchildVC=storyboard.instantiateViewController(withIdentifier:"childVC")a

ios - 请求 caretRectForPosition : while the NSTextStorage has outstanding changes

我最近遇到错误:requestingcaretRectForPosition:whiletheNSTextStoragehasoustandingchanges{x,x}*“杰出”字面意思,不是我的错字。当我使用enumerateAttribute()方法遍历NSTextView子类的NSTextStorage并操纵NSTextAttachment在TextView中每次更改后的TextView中。funcmanipulateText(){lettext=customTextView.textStoragetext.enumerateAttribute(NSAttachmentAttr

android - 插页式 Admob 广告 : "IllegalStateException: Only fullscreen activities can request orientation"

背景我有一个使用AdmobSDK的应用,用于显示插页式广告(全屏广告)。最近,Google更新了SDK以及许多其他内容(构建工具、gradle插件、IDE等...),包括admob(firebase广告)。compile'com.google.firebase:firebase-ads:11.4.2'问题更新后,我注意到每当应用尝试展示插页式广告时,它都会崩溃。崩溃日志是这样的:10-2814:01:01.3944523-4523/...I/Ads:Adopening.10-2814:01:01.4001606-2154/?E/ActivityManager:ActivityManag

android - 插页式 Admob 广告 : "IllegalStateException: Only fullscreen activities can request orientation"

背景我有一个使用AdmobSDK的应用,用于显示插页式广告(全屏广告)。最近,Google更新了SDK以及许多其他内容(构建工具、gradle插件、IDE等...),包括admob(firebase广告)。compile'com.google.firebase:firebase-ads:11.4.2'问题更新后,我注意到每当应用尝试展示插页式广告时,它都会崩溃。崩溃日志是这样的:10-2814:01:01.3944523-4523/...I/Ads:Adopening.10-2814:01:01.4001606-2154/?E/ActivityManager:ActivityManag

ios - 界面测试失败 : Failed to update to requested orientation

在持续集成下有时会出现这样的错误(貌似是随机错误):TestAssertionUITestingFailure-failed:Failedtoupdatetorequestedorientation.在测试时,设备旋转到横向模式并且...它不会返回到纵向模式。为什么?您知道可能导致此类问题的原因吗?在代码中我有一行:XCUIDevice.shared().orientation=.landscapeLeftXCUIDevice.shared().orientation=.portrait貌似跟下面的部分代码有关,但是不知道怎么解决。感谢任何帮助。 最佳答案

ios - UIDevice.current.setValue(value, forKey : "orientation") does not work if phone held in landscape and tilted 45 - 90 degrees

我在用letvalue=UIInterfaceOrientation.landscapeRight.rawValueUIDevice.current.setValue(value,forKey:"orientation")强制呈现ViewController以横向显示。这是导航Controller流程的一部分。这按预期工作,但如果手机横向放置并倾斜45到90度,View将以纵向显示。该方法被调用并且预期值是正确的,但景观没有发生变化。这可以在带有导航Controller的基本项目中重现。有谁知道是什么导致了这种行为? 最佳答案 我也

iOS 启动 Storyboard : How can I change a Tab Bar's tint color?

我在做什么:使用“启动Storyboard”。它非常简单,并且包含一个默认的UITabBarController。我在启动Storyboard和我的应用程序中将选项卡栏的“tintColor”设置为红色。我正在使用Xcode7、iOS9。什么不起作用:启动屏幕使用默认的蓝色iOS色调加载选项卡栏...!然后在加载后,当启动屏幕Storyboard被替换时,色调颜色会切换为红色。您究竟打算如何在Storyboard中设置标签栏的色调?演示项目:http://s000.tinyupload.com/?file_id=73998115878034693063 最佳

ios swift : Is it possible to change the font style of a certain word in a string?

我正在从数据库中提取字符串形式的内容。我用一种方法从这个字符串中提取最长的单词。现在我想将整个字符串打印到文本标签中,但想以不同的颜色和文本样式突出显示字符串中最长的单词。我该怎么做?我是否需要将字符串切成小块-设置格式-并在将其提供给标签之前将它们重新组合在一起?或者还有其他(更好)的方法吗? 最佳答案 如果您已经知道最长的单词,则必须获取该单词在字符串中的范围。为此,我更喜欢NSString方法rangeOfString:。然后您使用您的默认属性从字符串创建一个NSMutableAttributedString。最后,您将突出显