I am browsing my application and I noticed that when I load certain (4 out of 112 to be exact) objects and load it in ViewControllerwith 4 UIStackView, everything written with code (i.e. no xib) there is a noticeable lag when loading, and especially when loading UIStackViews. I ran a performance trace and noticed the only difference between the quickly viewed views, and those that lag behind are methods NSISEnginethat call more than 6 times (especially [NSISEngine Optimize]). Does anyone know why this only pops up for <5% of cases?
- The amount of data for each object does not matter, since there are large objects that do not have this problem.
I use custom ones UIStackViewthat expand when used, and this is the code I use:
func toggle() {
guard subView != nil else {
return
}
let rotation = isExpanded ? 0 : π / 2
isExpanded = !isExpanded
setSpacing(for: self)
t1 = Date()
UIView.animate(withDuration: kExpansionTime, animations: {
self.arrowView.transform = CGAffineTransform(rotationAngle: rotation)
self.subView?.isHidden = !self.isExpanded
self.layoutIfNeeded()
}) {_ in
t2 = Date()
print(t2.timeIntervalSince(t1))
}
}
Change . This does not happen on iOS 10, only on iOS 9 (maybe this is a bug)?
source
share