uilabel

How do I change the font size of a UILabel in Swift?

女生的网名这么多〃 提交于 2021-02-17 07:25:48
问题 label.font.pointSize is read-only, so I'm not sure how to change it. 回答1: You can do it like this: label.font = UIFont(name: label.font.fontName, size: 20) Or like this: label.font = label.font.withSize(20) This will use the same font. 20 can be whatever size you want of course. Note: The latter option will overwrite the current font weight to regular so if you want to preserve the font weight use the first option. Swift 3 Update : label.font = label.font.withSize(20) Swift 4 Update : label

Center UILabel created in code using Swift

ぐ巨炮叔叔 提交于 2021-02-11 15:43:58
问题 This may be the simplest thing you can possibly due in Xcode in Swift and for some reason, it is not working properly. I want to center a label in a view. The only other thing in the view previously was a webView added programatically but for now I have removed that so basically, I have an empty VC in which I'm trying to center a label. There are umpteen answers on SO about this and I've tried every combination but can't get it to to work. Can anyone suggest a foolproof way to accomplish the

How to create one sided arrowed label

心已入冬 提交于 2021-02-10 14:17:19
问题 I am not looking out for code snippet. I am just curious to know how to develop a UI component which is shown below. I have multiple thoughts on creating it, but would love to know the best approach Create a label and do some operations on its layer Set background image and add text on label Set image which has text on it What will be the good approach to develop it. Any suggestions please. 回答1: You want to display a single line of text. You can use a UILabel for that. You have a shape you

How to create one sided arrowed label

。_饼干妹妹 提交于 2021-02-10 14:14:59
问题 I am not looking out for code snippet. I am just curious to know how to develop a UI component which is shown below. I have multiple thoughts on creating it, but would love to know the best approach Create a label and do some operations on its layer Set background image and add text on label Set image which has text on it What will be the good approach to develop it. Any suggestions please. 回答1: You want to display a single line of text. You can use a UILabel for that. You have a shape you

How to properly morph text in iOS?

核能气质少年 提交于 2021-02-07 22:23:29
问题 I'm desperately trying to morph a smallLabel into a bigLabel . By morphing , I mean transforming the following properties from one label to match the respective properties of the other label, with a smooth animation: font size font weight frame (i.e. bounds and position) The desired effect should look similar to the animation that is applied to the navigation controller's title label when using large titles: Now I'm aware of last year's WWDC session Advanced Animations with UIKit where they

How to properly morph text in iOS?

二次信任 提交于 2021-02-07 22:17:11
问题 I'm desperately trying to morph a smallLabel into a bigLabel . By morphing , I mean transforming the following properties from one label to match the respective properties of the other label, with a smooth animation: font size font weight frame (i.e. bounds and position) The desired effect should look similar to the animation that is applied to the navigation controller's title label when using large titles: Now I'm aware of last year's WWDC session Advanced Animations with UIKit where they

How to properly morph text in iOS?

旧时模样 提交于 2021-02-07 22:15:41
问题 I'm desperately trying to morph a smallLabel into a bigLabel . By morphing , I mean transforming the following properties from one label to match the respective properties of the other label, with a smooth animation: font size font weight frame (i.e. bounds and position) The desired effect should look similar to the animation that is applied to the navigation controller's title label when using large titles: Now I'm aware of last year's WWDC session Advanced Animations with UIKit where they

How to properly morph text in iOS?

杀马特。学长 韩版系。学妹 提交于 2021-02-07 22:11:28
问题 I'm desperately trying to morph a smallLabel into a bigLabel . By morphing , I mean transforming the following properties from one label to match the respective properties of the other label, with a smooth animation: font size font weight frame (i.e. bounds and position) The desired effect should look similar to the animation that is applied to the navigation controller's title label when using large titles: Now I'm aware of last year's WWDC session Advanced Animations with UIKit where they

How to properly morph text in iOS?

半腔热情 提交于 2021-02-07 22:10:27
问题 I'm desperately trying to morph a smallLabel into a bigLabel . By morphing , I mean transforming the following properties from one label to match the respective properties of the other label, with a smooth animation: font size font weight frame (i.e. bounds and position) The desired effect should look similar to the animation that is applied to the navigation controller's title label when using large titles: Now I'm aware of last year's WWDC session Advanced Animations with UIKit where they

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

丶灬走出姿态 提交于 2021-02-06 09:39:05
问题 I can't figure out how to code a drop shadow on a label. I have a score label that changes so just photoshopping text with shadows wont be possible. I need to code it so it automatically has a blurry shadow behind the text at all times. Can anyone come with some examples or help? People saying this is a duplicate, the "duplicate" is about drop shadows on UIView, mine is about UILabel. It's not the same thing. 回答1: Give this a try - you can run it directly in a Playground page: import UIKit