I have a function in my UIView
subclass. This function adjust the layout of the view.
For example
func addItemAtIndex(index: Int){
// layout the view
item[index].frame.size = view.frame.size
}
I can call myView.addItem(5)
as normal.
Since this function adjust the view's layout, I can also call this function inside UIView
's animation block. And it will layout the view with animation.
Like this,
UIView.animateWithDuration(0.3){
myView.addItem(5)
}
However, I want to do the different behaviour when it's animated. Is it possible to check if the function get called inside UIView
's animation block ?
Like this,
func addItemAtIndex(index: Int){
if insideUIViewAnimationBlock{
// layout with animation
}else{
// layout
}
}
I'm not looking for addItemAtIndex(index: Int, animated: Bool)
approach.