uilabel

Line breaks not working in UILabel

假装没事ソ 提交于 2019-12-06 03:13:26
问题 I'm loading some help text from a plist and displaying the same in the form of UILabels housed in a UIScrollView. Portion of the code follows: UILabel *sectionDetailLabel = [[[UILabel alloc] initWithFrame:CGRectMake(34, myOriginForThisSection, 286, 20)] autorelease]; sectionDetailLabel.backgroundColor = [UIColor clearColor]; sectionDetailLabel.numberOfLines = 0; sectionDetailLabel.font = [UIFont systemFontOfSize:12]; sectionDetailLabel.textColor = [UIColor blackColor]; sectionDetailLabel

Retain the resolution of the label after scaling in iphone

早过忘川 提交于 2019-12-06 02:59:08
I am having a label in a view.After scaling the view, the label looks little blurred,the resolution is lost.How to retain the resolution after scaling. Here is my code for scaling secondView.transform = CGAffineTransformIdentity; [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:1.0]; secondView.transform = CGAffineTransformMakeScale(2 ,2); [UIView commitAnimations]; [self.view bringSubviewToFront:secondView]; I set the ContentScaleFactor property of the label to retain the resolution of the label after scaling . [label setContentScaleFactor:2]; Create a label of big size

UILabel size calculated incorrectly when changing font in UILabel

一曲冷凌霜 提交于 2019-12-06 02:49:35
问题 I am adding a UILabel to a view with the following layout requirements: The label should be centered The label should have a maximum font size of 100 points, but should scale down to fit. It should not truncate. The label's height should not exceed 450 points. Another view will be positioned directly below the label. My label's properties layout constraints seem to describe this adequately: let label = UILabel() label.backgroundColor = UIColor.yellowColor() label.font = UIFont

Set matching font sizes on UILabels in a UITableViewCell when one Label adjustFontSizeToFitWidth

北城以北 提交于 2019-12-06 02:14:27
I have two UILabel in a custom tableViewCell . One label has width constraints and is set to adjustFontSizeToFitWidth on smaller screens e.g. 5S. How can I get the other UILabel to match the font size of the first label, when it does not have particular width constraints? It seems sizeWithFont:minFontSize:actualFontSize:forWidth:lineBreakMode: was deprecated in iOS7, so what is the Swift solution? This answer When do adjustsFontSizeToFitWidth or boundingRectWithSize change the context.actualScaleFactor? isn't complete, and I need this to happen in a TableViewCell. This is what I have in my

Change the default '…' at the end of a text if the content of a UILabel doesn't fit

淺唱寂寞╮ 提交于 2019-12-06 01:51:38
问题 I have a UILabel in my iPhone project that has a fixed width and height but it's content can vary depending what the user is looking at. Sometimes the text is to big for the UILabel and that is when the string: '...', gets added to the end of the line. I wonder if I could change this string to something else, for instance: '(more)'. Thanks! 回答1: Unfortunately, it appears that such an option is not included on iOS, as per this similar question: How to change truncate characters in UILabel?

Add UILabel Under UICollectionView Cell

删除回忆录丶 提交于 2019-12-06 01:37:31
问题 I have a UICollectionView that shows images, similar to cover art, or iBooks. I would like for it to show the title of the audio clip underneath the UIImageView. I have in my MainWindow.xib a View Controller with a UICollectionView inside it. I also built a NibCell.xib for the cell itself. In the Cell, I have a UIImageView that fills up all but the bottom 30 px of the cell. In this area I add a UILabel. I give the UIImageView a tag of 100 and UILabel a tag of 200, and in my code I put: -

duplicate rows in tableview on uitableviewcell

廉价感情. 提交于 2019-12-06 01:26:49
问题 I have found some posts which are similar to my issue but not quite the same. In my app the user can navigate between several uitableviews to drill down to the desired result. When a user goes forward, then backward, then forward, etc it is noticeable that the rows are being redrawn/re-written and the text gets bolder and bolder. I have found that in some of the posts this may relate to the way that I am creating the rows, using a uilable within the cellforrowatindexpath method. Is there

Setting the same font size for different labels AFTER scaling

╄→гoц情女王★ 提交于 2019-12-05 23:32:26
问题 I am making an app where I have 3 labels. I am using label auto-shrinking to help adapt the label's font size to the device. These labels are right next to each other, and that therefore means that I want them to have them the same font size. What currently happens is (because they have different amounts of text) they end up shrinking to different font sizes. Is there a way to make it so that after scaling, the label with the smallest font size is the standard font for all of the other labels

Problem with custom label in UITableViewCell

 ̄綄美尐妖づ 提交于 2019-12-05 22:49:03
I have UITableViewController. In cellForRowAtIndexPath method I added custom setup for label: UILabel *lblMainLabel = [[UILabel alloc]initWithFrame:CGRectMake(50, 9, 150, 25)]; lblMainLabel.text = c.Name; lblMainLabel.font = [UIFont fontWithName:@"Helvetica-Bold" size:20]; lblMainLabel.backgroundColor = [UIColor clearColor]; lblMainLabel.textColor = [UIColor whiteColor]; [cell.contentView addSubview:lblMainLabel]; [lblMainLabel release]; But when I scroll UP or DOWN in table it always add this label on top of previous what I miss? you should create the UILabel exactly one time, when you create

TTTAttributedLabel “Read More >” tail truncation with several attributes possible?

核能气质少年 提交于 2019-12-05 22:35:26
TTTAttributedLabel support a custom truncation string via truncationTokenString as well as truncationTokenStringAttributes . However, I am wanting to go a bit further and set several string attributes on the truncation string, including different fonts and colours. This is what I am trying to achieve: The arrow at the end can be achieved using a font icon, so I was thinking of the following string: @"… Read More >" 'HORIZONTAL ELLIPSIS' (U+2026) + Read More + > character from a font . Unfortunately TTTAttributedLabel doesn't allow me to set the ranges for various attributes. Does anyone have a