Can font size of UILabel be changed with smooth animation on iPhone?

Set the font on the UILabel to be the size that you want when it is enlarged. Then scale it down. When you want the label to swell, scale it back up to it’s original size. messageLabel.font = [UIFont boldSystemFontOfSize:45]; messageLabel.transform = CGAffineTransformScale(messageLabel.transform, 0.25, 0.25); [self.view addSubview:messageLabel]; [UIView animateWithDuration:1.0 animations:^{ messageLabel.transform = CGAffineTransformScale(messageLabel.transform, 4, 4); …

Read more

Adjust letter spacing in iOS 7

You can adjust letter spacing like this, using NSAttributedString. In Objective-C: NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:@”The Clash”]; [attributedString addAttribute:NSKernAttributeName value:@(1.4) range:NSMakeRange(0, 9)]; self.label.attributedText = attributedString; In Swift 3: let attributedString = NSMutableAttributedString(string: “The Clash”) attributedString.addAttribute(NSKernAttributeName, value: CGFloat(1.4), range: NSRange(location: 0, length: 9)) label.attributedText = attributedString In Swift 4 and later: label.attributedText = NSAttributedString(string: “The …

Read more

How do I sizeToFit a UILabel by changing only the height and not the width?

You can achieve the same result with sizeThatFits. CGSize size = [label sizeThatFits:CGSizeMake(label.frame.size.width, CGFLOAT_MAX)]; CGRect frame = label.frame; frame.size.height = size.height; label.frame = frame; Or alternatively, with sizeToFit. CGRect frame = label.frame; [label sizeToFit]; frame.size.height = label.frame.size.height; label.frame = frame;

How to make a drop shadow effect on a label in Swift?

Give this a try – you can run it directly in a Playground page: import UIKit import PlaygroundSupport let container = UIView(frame: CGRect(x: 0, y: 0, width: 600, height: 400)) container.backgroundColor = UIColor.lightGray PlaygroundPage.current.liveView = container var r = CGRect(x: 40, y: 40, width: 300, height: 60) let label = UILabel(frame: r) label.font = UIFont.systemFont(ofSize: …

Read more

Using custom fonts with Xcode 6 / iOS 8 Interface Builder Launch Screen

Did you actually added it to the plist File? Here’s a short introduction how to do this: http://codewithchris.com/common-mistakes-with-adding-custom-fonts-to-your-ios-app/ Greetings, Alex EDIT: Actually I tried to add my own fonts to my with the interface Builder and it doesn’t work. Seems to be a bug… This bug only appears, when I use an attributed String