uilabel

Way to draw NSString on a curved path?

匆匆过客 提交于 2020-01-14 09:04:04
问题 I have been looking for any example code for drawing a UILabel (or just an NSString or something) on a curved path, but have come up empty handed. Does anyone know whether it's possible to draw text on a curved path, like a circle or something, without using separate pieces of graphics for every single letter? 回答1: Split the String into letters and then so something like this: How do I draw an NSString at an angle? increasing the angle and changing the position after every letter. 来源: https:/

iPad - find the true height of a UIWebView

浪子不回头ぞ 提交于 2020-01-14 04:17:05
问题 I work for a media company, and in our iPad application we're upgrading our content so it looks better. Previously, we used a UILabel to display the contents of our posts. I used this to get the actual height of my UILabel: CGSize expectedSize = [label.text sizeWithFont:label.font constrainedToSize:maximumLabelSize lineBreakMode:label.lineBreakMode]; However, we changed our posts' content to HTML, so I'm using a UIWebView. Is there a way to find the true height of the UIWebView, like I do

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

你说的曾经没有我的故事 提交于 2020-01-13 14:40:23
问题 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

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

最后都变了- 提交于 2020-01-13 14:38:12
问题 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

NSTextAlignment.Justified for UILabel does not work

浪子不回头ぞ 提交于 2020-01-12 07:44:05
问题 I am trying to justify my UILabel text but it does not work. Declaration of my UIView : descriptionUIView = UIView(frame: CGRect(x: 0, y: 0, width: self.view.frame.width, height: self.view.frame.height) Declaration of my UILabel : bottleDescriptionLabel = UILabel(frame: CGRect(x: widthMargin, y: bottleDescriptionTitleLabel.frame.maxY + heightMargin, width: self.view.frame.width - (2 * widthMargin), height: heightBottleDescription - (2 * heightMargin))) bottleDescriptionLabel.font = UIFont

How can I detect taps on a particular part (substring) of a UILabel?

人盡茶涼 提交于 2020-01-12 04:52:09
问题 I am new to iOS development. I dont know whether this questions has been asked already or not, I tried searching for the solution on stackoverflow but didn't get any results. Question : I have a UILabel called myLabel with the text: "Click here to proceed" Now the problem is I want to perform an action when user taps only "Click". I know how to use UITapGestureRecognizer , but it responds to the whole UILabel . Is it possible to just detect when user taps only on string "Click"? 回答1: You

IBOutlet does not display its value in UI

故事扮演 提交于 2020-01-11 13:29:09
问题 I am building an iOS app using storyboards.I have implemented google maps in my app using swift and rest of the code is in objective C. My scenario: 1.As shown in the diagram, when I click on the label in front of location ( in First view controller ) a modal segue opens a second view controller containing map. 2.In the map view controllers, when the user moves the map with touch, I'm getting address value in a label. ( similar to uber app ) 3.After this , as soon as user presses done button

Two uilabels on uitable with dynamic height

大兔子大兔子 提交于 2020-01-11 13:09:24
问题 I am trying to implement one English to Swedish learning app for Swift/IOS there I want to have two dynamic rows, data is coming from array and I tried my best to fix it out. I have seen approx. all stack overflow links as well but no success at all. See the screenshot, as the text is long, I cannot see it on the screen and the text is not coming on the second line as well. As, I add any constraint, both lines sometimes disappeared or only one lines comes. I have seen this tutorial link as

Two uilabels on uitable with dynamic height

女生的网名这么多〃 提交于 2020-01-11 13:09:07
问题 I am trying to implement one English to Swedish learning app for Swift/IOS there I want to have two dynamic rows, data is coming from array and I tried my best to fix it out. I have seen approx. all stack overflow links as well but no success at all. See the screenshot, as the text is long, I cannot see it on the screen and the text is not coming on the second line as well. As, I add any constraint, both lines sometimes disappeared or only one lines comes. I have seen this tutorial link as

How can I get text to wrap in a UILabel (via UIViewRepresentable) without having a fixed width?

爱⌒轻易说出口 提交于 2020-01-10 05:33:11
问题 Setting lineBreakMode to byWordWrapping and set numberOfLines to 0 does not seem to be sufficient: struct MyTextView: UIViewRepresentable { func makeUIView(context: Context) -> UILabel { let label = UILabel() label.lineBreakMode = .byWordWrapping label.numberOfLines = 0 label.text = "Here's a lot of text for you to display. It won't fit on the screen." return label } func updateUIView(_ view: UILabel, context: Context) { } } struct MyTextView_Previews: PreviewProvider { static var previews: