ios - swift animate all added views alpha -
i want animate views (based on tag) alpha change, getting "cannot assign alpha view" error. way this?
all views have alpha of 0 upon being added subview of mycustomview
func transitioneffects() { uiview.animatewithduration(0.5, animations: { view in self.mycustomview.subviews { if(view.tag != 999) { view.alpha = 1 } } }) }
this because swift needs know kind of objects inside subviews nsarray
before sending methods.
nsarray
automatically converted in swift array
of anytype
objects, doesn't know kind of objects extracted array. casting array array of uiview
s objects should work fine.
func transitioneffects() { uiview.animatewithduration(0.5, animations: { view in self.mycustomview.subviews [uiview] { if(view.tag != 999) { view.alpha = 1 } } }) }
Comments
Post a Comment