ios - How i can display a image -
how can display image automatically 5 seconds after open page , move ?
i have piece of code, image display automatically 5 seconds after open page not move why.
class yourviewcontroller: uiviewcontroller{ @iboutlet weak var moveobj: uiimageview! override func viewdidload(){ super.viewdidload() moveobj.hidden = true moveobj.alpha = 0 nstimer.scheduledtimerwithtimeinterval(5, target: self, selector: #selector(uiviewcontroller.showmybtn), userinfo: nil, repeats: false) } func showmybtn(){ uiview.animatewithduration(1, animations: { self.moveobj.hidden = false self.moveobj.alpha = 1 }) } } override func viewdidappear(animated: bool) { super.viewdidappear(animated) let orbit = cakeyframeanimation(keypath: "position") var affinetransform = cgaffinetransformmakerotation(0.0) affinetransform = cgaffinetransformrotate(affinetransform, cgfloat(m_pi)) let circlepath = uibezierpath(arccenter: cgpoint(x: 198 - (100/2),y: 135 - (100/2)), radius: cgfloat(155), startangle: cgfloat(255), endangle:cgfloat(m_pi * 2), clockwise: true) orbit.path = circlepath.cgpath orbit.duration = 3 orbit.additive = true orbit.repeatcount = 0.2 orbit.calculationmode = kcaanimationpaced moveobj.layer .addanimation(orbit, forkey: "orbit")
Comments
Post a Comment