uilabel

iOS 7/8 UITableView Cell: Two UILabels with dynamic height with auto layout for variable row height

自闭症网瘾萝莉.ら 提交于 2019-12-22 01:46:02
问题 So I am able to set up dynamic height sizing with auto layout when I have only one label that changes the height based on the length of the string. My problem is that if I add another UILabel that should do the same, things don't work out. I am setting both the Content Hugging priority and the Compression Resistance to 1000 for both == I get warnings of ambiguity If I set the Content Hugging (Vertical) for the second UILabel to 999 or 250 then it works great but only if the second label has 2

How to display Text in Arabic in UIlabel

久未见 提交于 2019-12-21 21:39:23
问题 I am getting this string from server in response, which is actually in arabic " نريد أن نرى هذا في اللغة العربية " You can see this text in arabic on browser like this : نريد أن نرى هذا في اللغة العربية browser automatically shows text in arabic. for former i have put code tag so it is showing codes... Now I want to show it on UILabel in arabic fonts, how would I do that? Please help.. Thanks 回答1: If you convert each 4 text digit decimal number in the server response string to a C int, then

How to make CustomLink touchable in OHAttributedLabel

大憨熊 提交于 2019-12-21 17:42:46
问题 I am successfully adding links to a UILabel via OHAttributeLabel and -(void)addCustomLink:(NSURL*)linkUrl inRange:(NSRange)range; In other words, the correct range is underlined and looks like a link. However, I cannot click/touch on the link. Is there anything else that must be done that the addCustomLink method on the range of text? FWIW, I am not using Interface Builder even though much of the OHAttributedLabel code makes references to IBOutlet . 回答1: The required code in this case was

UILabel with numberOfLines and lineBreakMode

拜拜、爱过 提交于 2019-12-21 12:06:05
问题 I am working on a project that has to support both iOS6 and iOS7. My problem is it works different on different systems. I'm trying to create UILabel with number of lines equal to 2, but when I set it's line break mode to NSLineBreakByTruncatingTail it works different. Explanation (numberOfLines = 2, text = @"long teeexxxttt"): iOS7 iOS6 NSLineBreakByWordWrapping ---------- ---------- |long | |long | |teeeexxxtt| |teeeexxxtt| ---------- ---------- NSLineBreakByTruncatingTail ---------- ------

UITableView with UILabel SizeToFit get mess when Scrolling

戏子无情 提交于 2019-12-21 11:05:03
问题 Hi everyone I have problem with my tableview , i make Cell with uilabel with SizeToFit and then calculate the UILabel Height for set the cell Height everything work well except when i scrolling my tableView the text get weird like one char per line: My TableViewVell Method is: -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier

swift: programmatically create UILabel fixed width that resizes vertically according to text length

橙三吉。 提交于 2019-12-21 09:33:57
问题 I've seen answers to vertical resizing that involve autolayout, but the UILabel s I'm creating are only needed at runtime. (I might need anywhere from zero to many of these labels.) Examples (ignore the color) Short text (note same width as longer text): Longer text (note same width as shorter text example with more lines for add'l text): If the text can fit in one line of fixed width, the label shouldn't need to resize vertically. But if there are more characters, the label should keep

iOS - Unable to set text of UILabel

放肆的年华 提交于 2019-12-21 07:15:09
问题 Ok let me explain the situation, I have two view controller let's call them first ans second. FirstViewController inherit from UITableViewController SecondViewController inherit From UIViewController The interface for the SecondViewController is made with Interface Builder and contains simply a label and an UIProgressView. both label and UIProgressView outlet are connected with the right files owner (SecondViewController). a little bit of code, In FirstViewController : the following method is

xCode ios5: How to fade out a label text after an interval?

a 夏天 提交于 2019-12-21 05:30:54
问题 I have a little iOS5 app that shows images. I click on the image to show its information. I'd like the information to fade away after a few seconds. Is there a good method to do this? I can always implement another button action but this would be neater.. Thanks! 回答1: Use either NSTimer or performSelector:withObject:afterDelay . Both methods require you to call a separate method that will actually do the fading out which should be fairly straightforward. Example: NSTimer [NSTimer

how to create a strong red glow effect on UILabel

耗尽温柔 提交于 2019-12-21 05:03:05
问题 I need to implement outer glow effect on UILabel (or CATextLayer) as above. I know to create glow effect on text, I need shadow with offset (0,0). I've touched down to the quartz2D level, following is the code I'm using: _backgroundDownLabel.layer.shadowColor = self.glowColor.CGColor; // red _backgroundDownLabel.layer.shadowOffset = CGSizeMake(0, 0); _backgroundDownLabel.layer.shadowOpacity = 1; _backgroundDownLabel.layer.shadowRadius = self.glowAmount; // tried 1-10 _backgroundDownLabel

How to set a label's preferredMaxLayoutWidth to automatic programmatically?

白昼怎懂夜的黑 提交于 2019-12-21 03:42:44
问题 I get the following errors when I attempt to set a label's Preferred Width to Automatic in a storyboard: Attribute Unavailable: Automatic Preferred Max Layout Width is not available on iOS versions prior to 8.0 Since I need my layout to work on both iOS 7 and 8, I was planning to do the following: Set the value to Explicit in the storyboard. On iOS 7, set the value to an explicit, computed width programatically. On iOS 8, set the value to automatic programatically. 1 and 2 are easy. How do I