uiviewanimation - drop shadow to remain at bottom of rotating uiview swift 3 -


how keep shadow @ bottom of rotating/ animating ui view

my code drop shadow follows

    extension uiview {      func dropshadow(cornerradius : cgfloat, heightoffset : int) {          self.layer.maskstobounds = false         self.layer.shadowcolor = uicolor.black.cgcolor         self.layer.shadowopacity = 1         self.layer.shadowoffset = cgsize(width: 0, height: heightoffset)         self.layer.shadowradius = 5 //remove bezier enable corner radius        // self.layer.shadowpath = uibezierpath(rect: self.bounds).cgpath         self.layer.cornerradius = cornerradius          self.layer.shouldrasterize = true     } } 

then in view controller call method in uiview animation

to hide

uiview.animate(withduration: 0.5, animations: {             views in self.menuview.subviews {                 views.alpha = 0             }             self.view.layoutifneeded()             self.morebutton.transform = tr               self.morebutton.dropshadow(cornerradius: self.morebutton.layer.cornerradius, heightoffset: 5)           } 

to show

    uiview.animate(withduration: 0.5, animations: {              self.morebutton.dropshadow(cornerradius: self.morebutton.layer.cornerradius, heightoffset: -5)             // menuv.center = self.menuview.center             menuv.center.y = -30             menuv.alpha = 1             self.view.layoutifneeded()               self.morebutton.transform = tr           }, completion: { (complete) in           }) 

the result shadow jumps top or bottom , rotates around.

i need remain @ bottom of layer @ times during animation.

could please , describe i'm possibly doing wrong

regards

thomas

found answer : -

rather rotate button whole made sense rotate image within button

so code should

            self.mybutton.imageview?.transform = tr 

Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -