i have uiview panel drawing signature , i've came bit of code expand , contract panel when tapped. seems work enough code seems clumsy , wondering if there's perhaps better way achieve this.
i added tap gesture recogniser view, hooked , have in .m
:
bool clientsiglarge; - (ibaction)handlesigtap:(id)sender { cgrect frame = self.clientsigview.frame; if (clientsiglarge) { frame.size.height -= 400; frame.size.width -= 350; frame.origin.x += 350; frame.origin.y += 400; self.clientsigview.frame = frame; clientsiglarge = no; } else { frame.size.height += 400; frame.size.width += 350; frame.origin.x -= 350; frame.origin.y -= 400; self.clientsigview.frame = frame; clientsiglarge = yes; } }
any tips appreciated.
to make smoother, use animation block , if scaling-proportion fixed (like 2x, 3x, etc.) use cgaffinetransformscale
[uiview animatewithduration: 1 delay: 0 options: (uiviewanimationoptioncurvelinear | uiviewanimationoptionallowuserinteraction) animations:^{myview.transform = cgaffinetransformscale(cgaffinetransformidentity, xscalevalue, yscalevale);} completion:^(bool finished) { } ];
so in if-else condition change x , y scale values , use same block.
here reference link animations
hope looking for
Comments
Post a Comment