草庐IT

check-constraints

全部标签

ios - Swift iOS -Constraint 即使调用了 view.layoutIfNeeded() 也没有动画

我有一个圆形的likeButton,它位于圆形的moreButton后面。likeButton固定到moreButton的centerX和centerY。当我按下moreButton时,我想将likeButton设置为比moreButton高200点的动画。我使用NSLayoutConstraint来跟踪likeButton的centerY并对其进行更改。当我调用UIView.animate并在它的闭包中调用self.view.layoutIfNeeded()时,View没有更新。@objcfuncmoreButtonTapped(){likeButtonCenterY?.isActi

ios - 快照套件 : How to set layout constraints for items in a TableViewCell programatically

我是swift/iOS开发的初学者。来自Web开发人员,与DOM/Box模型相比,布局模型让我完全困惑。我知道这意味着全神贯注,但就我的生活而言,我似乎无法弄明白,我希望像这样的基本示例可能有助于说明一些事情,即使我正在使用DSL像snapkit:http://snapkit.io/我怎样才能为如下布局构建约束:到目前为止,我所知道的显然是错误的如下:label1.snp.makeConstraints{(make)->Voidinmake.leading.equalTo(Style.MARGIN)make.trailing.equalTo(-Style.MARGIN)make.cen

ios - Swift 单元测试 : module name of object class causes type check to fail

我已经在我的项目中进行了几周的单元测试,到目前为止它们一直运行良好。我的一个新单元测试实例化了我的一个自定义ViewController。所述ViewController实例化并添加类型为CoolSearchBar的subview,这是我自己创建的一个类(.swift文件和.xib文件)。在上述ViewController中,我以编程方式加载了CoolSearchBar实例,然后将其添加到View层次结构中,如下所示:guardletsearchBar=Bundle.main.loadNibNamed(String(describing:CoolSearchBar.self),owne

ios - swift 3.0 : Paramater to check for action completion

我最近开始学习应用程序开发,几乎所有我能找到的教程都不在swift3中,所以有时当涉及到某些已更改的语法时,我会感到困惑。//TaketheusertothegamescreenfromtheintrosceneletintroLabel=childNode(withName:"introLabel")ifintroLabel!=nil{letfadeOut=SKAction.fadeOut(withDuration:1)introLabel?.run(action:fadeOut,completion:()->Void)}我已经在整个互联网上进行了搜索,但似乎找不到我应该放在这里的丢

iOS 用户界面测试 : How can I check an appointment in the calendar?

我正在iPad上使用XCTest通过Xcode运行UI测试。此测试中的操作导致在iOS的标准日历应用程序中设置约会。该日期将始终与测试运行的日期相同。如果日历应用程序中的日期设置正确,是否有办法检查相同的测试功能? 最佳答案 借助Xcode9,您现在可以访问UITest中的其他应用。因此,要测试事件是否已正确添加到日历中,您可以编写一个简单的测试:(我为此使用了一个小型演示应用程序。它只有一个按钮“添加事件”,用于添加当天早上5点到早上7点的事件)importXCTestclassCalendarUITestDemoUITests:

ios - 由于未捕获的异常 'NSGenericException' 而终止应用程序,原因 : 'Unable to activate constraint with anchors

我正在努力寻找和思考这个问题,但我找不到解决它的最佳方案!!我不明白这是什么意思?!Terminatingappduetouncaughtexception'NSGenericException',reason:'Unabletoactivateconstraintwithanchorsandbecausetheyhavenocommonancestor.Doestheconstraintoritsanchorsreferenceitemsindifferentviewhierarchies?That'sillegal.'代码:privateletlogoImageView:UIIma

swift - _AVAE_Check : required condition is false: [AVAudioEngine. mm :353:AttachNode: (node ! = nil)] 在创建 AKDelay 时

我有一个最小的MacOS应用程序(一个ViewController+一个按钮),其中包含以下代码(基本上是来自AudioKit'splayground的复制粘贴):publicclassPlayer{staticletplayRate=2.0staticletscale=[0,2,4,5,7,9,11,12]varpluckedString:AKPluckedString!=nilvardelay:AKDelay!=nilvarreverb:AKReverb!=nilvarperformance:AKPeriodicFunction!=nilpublicinit(){pluckedSt

swift - @_downgrade_exhaustivity_check Swift 私有(private)关键字是什么?

在浏览Swift存储库时,我遇到了那个关键字。这是什么意思?例如,来自Time.swift:publicenumDispatchTimeInterval:Equatable{caseseconds(Int)casemilliseconds(Int)casemicroseconds(Int)casenanoseconds(Int)@_downgrade_exhaustivity_checkcasenever} 最佳答案 实际的提交消息状态Implement@_downgrade_exhaustivity_checkDispatchre

ios - swift : Checking if 2 NSDates are the same

非常简单,我确定这是swift中的一个错误。我正在尝试检查2个NSDates是否相同。即使打印输出在下面,这个声明也永远不会通过println("\(statistics.startDate)\(healthObject.date)")ifhealthObject.date.isEqualToDate(statistics.startDate){healthObject.flights=Int(quantity.doubleValueForUnit(HKUnit.countUnit()))println(Int(quantity.doubleValueForUnit(HKUnit.co

swift - 错误 "Redundant constraint ' self ' : 'AnyObject' "- where is the `AnyObject` ?

我在开发时发现了一条奇怪的Swift编译器消息(我使用的是Swift4.1):protocolFoo:classwhereSelf:NSObject{//(1)//Redundantconstraint'Self':'AnyObject'}这里发生了什么?首先,这不是多余的。当我写protocolFoo:class{}//(2)我有一个任何对象都可能遵守的协议(protocol),甚至不是从NSObject派生的对象。但我可以创建弱引用:weakvarf:Foo?没问题。另一方面,当我写的时候protocolFoowhereSelf:NSObject{}//(3)我有一个无法生成弱引用