问题
在iOS10和iOS11上运行相同的代码我的UIViewPropertyAnimator在更改其.isReversed属性后就有了不同的行为.
在iOS10上一切都很好.动画问题发生在iOS11上
条件
对于任何动画都是如此,不仅对于特定的动画,它都可以通过观看动画和代码来验证.它发生在模拟器和真实设备上.
DETAILS
一旦用他的动画创建了一个UIViewPropertyAnimator,在它运行期间我只需调用.pauseAnimation()并将.isReversed属性更改为true.之后我恢复了动画调用:
continueAnimation(withTimingParameters parameters: UITimingCurveProvider?, durationFactor: CGFloat)
Run Code Online (Sandbox Code Playgroud)
在iOS10的这一点上,动画平滑地改变了他的诗句,在iOS11上它立即停止并且以一点帧滞后反转.
如果在代码中我检查.fractionComplete(在我的UIViewPropertyAnimator对象上调用它的值,让我回到完成动画的百分比值,从0.0开始,结束于1.0)之后.continueAnimation(...
- 在iOS 10上,它会保留一段时间,如果动画仍在继续,只有在一段时间后跳到他的补充.
- 在iOS 11上,它突然跳起来在他的补充
文件中有与此相关的非更新,只是UIViewPropertyAnimator的几个新属性但未使用,因为我的目标是iOS10
可能是一个错误或我错过了什么!?
小更新:刚刚测试过,iOS 11.0.1和iOS 11.1 beta1上的行为相同
在评论中链接,这只发生在非线性曲线上!
在WWDC2016上Apple引入NSPersistentContainer了iOS10
该NSPersistentContainer类是负责加载数据模型,创建一个管理对象模型,并使用它来创建的NSPersistentStoreCoordinator.
它的初始化非常简单:
let container = NSPersistentContainer(name: "myContainerName")
container.loadPersistentStores(completionHandler: { /* ... handles the error ... */ })
Run Code Online (Sandbox Code Playgroud)
以前在CoreData堆栈创建中我们设置了NSPersistentStoreCoordinator添加PersistentStore,特别是"ofType"和"storeOptions"
let psc = NSPersistentStoreCoordinator(managedObjectModel: mom)
psc.addPersistentStore(ofType: NSSQLiteStoreType, configurationName: nil, at: storeURL, options: [NSPersistentStoreFileProtectionKey:FileProtectionType.complete, NSMigratePersistentStoresAutomaticallyOption: true] as [NSObject : AnyObject])
Run Code Online (Sandbox Code Playgroud)
在这种情况下使用
NSSQLiteStoreTypefor ofType 参数
和
[NSPersistentStoreFileProtectionKey:FileProtectionType.complete, NSMigratePersistentStoresAutomaticallyOption: true]
for options 参数
如何配置这种东西NSPersistentContainer?
我有一组[User]叫做conversationUsers 的用户
用户定义为
public class User: NSManagedObject { ... }
Run Code Online (Sandbox Code Playgroud)
并且currUser是一个User对象
如果我试试
currUser == conversationUsers[0]
Run Code Online (Sandbox Code Playgroud)
结果是真的
但
conversationUsers.contains(currUser)
Run Code Online (Sandbox Code Playgroud)
结果错了
相反,我使用
conversationUsers.contains({$0 == currUser})
Run Code Online (Sandbox Code Playgroud)
它返回true
仅供参考我还定义了这个:
public func ==(lhs: User, rhs: User) -> Bool {
let logicalExpression = lhs.email.lowercaseString == rhs.email.lowercaseString
return logicalExpression
}
Run Code Online (Sandbox Code Playgroud)
为什么包含返回false?这是他的默认谓词?
谢谢您的帮助