uilabel

IOS 5.1 UILabel with Heavy Check Mark character ignores TextColor

限于喜欢 提交于 2019-12-07 14:39:32
问题 I've been developing an iOS app and recently "upgraded" to xCode 4.3.1 and the iOS 5.1 simulator and have a very strange issue with just one character. It's called "Heavy Check Mark" in the character viewer and it looks great in my app in 5.0.1 and below and is colored with a .textColor = [UIColor redColor]. In 5.1 it shows up black in the simulator and since my phone is jailbroken I haven't checked it in 5.1 on an actual device. If I put in any other character it shows up red, but this one

What is best way to make UILabel Glow and look bright?

好久不见. 提交于 2019-12-07 10:39:06
问题 I made UILabel showing current time, I want that time(UILabel) glow on the screen, I tried many answers which I found via google, but no one is properply working, need like this ,,, http://i.stack.imgur.com/4REJp.png I tried some think like as below, In ViewDidLoad colorOne = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1.0]; colorTwo = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1.0]; //Create the gradient and add it to our view's root layer gradientLayer = [[[CAGradientLayer

How to change UILabel width based on text length in iOS?

落爺英雄遲暮 提交于 2019-12-07 10:01:39
问题 I want to display an image next to a 'UILabel', however 'UILabel' has variable text length, so I don't know where to place the image. Image should move according to the size of the label. How can I accomplish this? 回答1: Although Keshav answer will work, it's deprecated try: NSDictionary *attributes = @{NSFontAttributeName: [UIFont fontWithName:@"HelveticaNeue" size:14]}; CGRect rect = [textToMeasure boundingRectWithSize:CGSizeMake(width, CGFLOAT_MAX) options

Customizing Title in the NavigationBar for a ABPeoplePickerNavigationController

可紊 提交于 2019-12-07 09:55:28
问题 I have created an AddressBook kind of application where I display a list of people in a UITableView, when a person is selected an ABUnknownPersonViewController is pushed. From this ABUnknownPersonViewController the user is able (by using the built in functionality) to either add the person to a "New Contact" or "Existing Contact". This is where my problem is located. I am using a Custom UILabel for the NavigationBar title throughout my application. And I need to be able to do this for the

Vertically aligning NSTextAttachment in NSMutableAttributedString

随声附和 提交于 2019-12-07 09:53:31
I'm adding an icon to a UILabel using NSTextAttachment inside an NSMutableAttributedString like this: //Setting up icon let moneyIcon = NSTextAttachment() moneyIcon.image = UIImage(named: "MoneyIcon") let moneyIconString = NSAttributedString(attachment: moneyIcon) //Setting up text let balanceString = NSMutableAttributedString(string: " 1,702,200") balanceString.insert(moneyIconString, at: 0) //Adding string to label self.attributedText = balanceString self.sizeToFit() But for some reason the icon isn't vertically aligned Does anybody know how can I align it? Thank you! This answer , which is

how to make characters equal width in UILabel

怎甘沉沦 提交于 2019-12-07 08:55:23
问题 I have a problem when using UILabel . I have two labels here(above images), they have equal font and equal width, textAlignment are both left, they both have 10 characters, but each character have different width so it can't be aligned one by one, I‘m trying to add spacing dynamically but I failed to do that, so how can I fix it? thanks a lot~ 回答1: The reason it fails is you are using a proportional font, meaning: characters will take up an individual width. An i will just take a friction of

Dynamic UILabel truncating the text

我只是一个虾纸丫 提交于 2019-12-07 07:41:37
问题 I'm using code provided in this answer to create a dynamic label and it works for the most part. But whenever the label text goes over 94 characters in length it gets truncated and ellipsis' are added. There is one more odd thing about this is that if I add more characters to the string they are shown but the last 2 lines are still truncated. Eg. The string: this is a very very long string with lots of words to test the dynamic bubble sizing one two three. shows up like this: this is a very

How to vertically align a UILabel used as a leftView in a UITextField with the textField's text?

陌路散爱 提交于 2019-12-07 07:07:16
问题 I'm using a UILabel as the leftView of a UITextField . The issue is that the textField's text is higher than the label's. This is the code I've used so far UILabel *startsWith = [[UILabel alloc] init]; startsWith.font = [UIFont systemFontOfSize:14]; startsWith.textColor = [UIColor blackColor]; startsWith.backgroundColor = [UIColor clearColor]; startsWith.text = @"Text"; [startsWith sizeToFit]; self.textField.leftViewMode = UITextFieldViewModeAlways; self.textField.leftView = startsWith; I've

UIStackView and multi-line labels in a UITableViewCell

我与影子孤独终老i 提交于 2019-12-07 06:09:09
问题 I want to have a custom UITableViewCell with a number of vertically stacked UILabel s all of which can contain text that wraps multiple lines. With the new UIStackView in iOS9 and the cell self-sizing mechanism I thought this would be straightforward, but I can't get it to work. I am using Xcode 7beta3. I created a simple test app. This is the setup in IB: The UIStackView is vertical with UIStackViewDistribution.Fill and UIStackViewAlignment.Fill but I have basically tried all the

change UILabel's text color for total project

空扰寡人 提交于 2019-12-07 05:44:02
问题 i want to change all the UILabel's text color for total app how can i do this .is there any simple way to change label color. i tried this ,but i want to change write this code in every class for( UIView *view in [testScroll subviews]) { if([view isKindOfClass:[UILabel class]]) { [(UILabel *)view setTextColor:[UIColor whiteColor]]; } else if([view isKindOfClass:[UIView class]]) } Do anyone have simple method . 回答1: Well if you're targeting iOS 5+ you could do that really easy (inside you