Reputation: 110
I have tried searching this functionality but didn't solved my problem.
What I Want: I have a UILabels text as "attended" with initial font size of 28 (totally four labels with different fonts sizes and texts). Now I vary slider (which is placed in the bottom), I will send the font size to be increased or increased. Now, i want to not only change the font size but also UILabel frame like
self.labelAttendCount.frame = CGRectMake(40 + (diff * 0.7) , 110 - (diff * 0.3), 40 - diff/5, 30 - (diff * 0.3))
self.labelAttendCount.font = UIFont(name: "ArialMT", size: round(28 - (diff * 0.28)))
Everything goes fine but, when its position is changing its jerky (or shaky). I want this to be dealt smoothly.
refer to this link where there is smooth increase or decrease in label size. http://macoscope.com/blog/ios-7-dynamic-type-simulator-for-designers/
Hope u understand my question.
Please check this shared video link (removed link)
This solution might be usefull for some one.
Finally got a Solution to shrink UILabel or UIButton Text and change their position:
Make UILabels as subview to UIView.
viewLeft.addsubView(labelAttendedCount)
later
viewLeft.transform = CGAffineTransformMakeScale(1 - (diff * 0.01), 1 - (diff * 0.01)) // to shrink viewLeft UIView
viewLeft.frame = CGRectMake(25 + (diff * 0.8), 110 - (diff * 0.3), 100 , 50 - diff/2) // to move the ViewLeft and diff is increase in the contentoffset or UIPanGesture location.y
viewLeft.center = CGPointMake(25 + viewLeft.frame.width/2 + (diff * 0.8), viewLeft.frame.origin.y + viewLeft.frame.height/2) // To adjust the position of the UIView.
Upvotes: 1
Views: 977
Reputation: 740
Instead of changing the font size, you can just use UIView's transform, e.g
self.labelAttendCount.transform = CGAffineTransformMakeScale(1.5, 1.5);
Upvotes: 2