uilabel

Automatically adjusting height of a UILabel

狂风中的少年 提交于 2019-12-23 19:33:09
问题 I'm using the following two methods (one is a category of NSString and the other a category of UILabel ) to automatically adjust the height of a label based on the text inside it. It's working fine for the mostpart, but it's having some unpredictable results. I'm not quite sure where the issue may be occuring and I'm hoping some of you fine folks can offer a helping hand. First off, here are the methods in question: NSString Category: - (CGFloat) fontSizeWithFont: (UIFont *) font

Change label from a different view [closed]

感情迁移 提交于 2019-12-23 18:16:38
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 7 years ago . This is mainly a delegation question because I'm still learning and don't get it. I don't know how to go about creating the delegate I need. I know similar questions have been asked but the solutions don't help

How to make multi-line UILabel text fit within predefined width without wrapping mid-word

≯℡__Kan透↙ 提交于 2019-12-23 17:21:26
问题 I have a UILabel carefully laid out in Interface Builder with proper height and width constraints. The number of lines is set to 4. The wrapping is set to word wrap. The text is "CHECKED". The font size is very large and thus it only fits "CHECKE" and the "D" is on the second line. Writing "Checked" instead of "CHECKED" lets the font shrink (as intended) so that the whole word fits. But (the text is user given and it can be expected that the user writes fully uppercase words) having uppercase

Does NSHTMLTextDocumentType support HTML table?

亡梦爱人 提交于 2019-12-23 17:12:08
问题 In my app, i want to display a text in a UILabel. I use HTML to store the text in my data base to dynamically from my text in my app. I actually use this (Swift 3.2, iOS 8+) : if let data = text.data(using: .utf8) { let htmlString = try? NSMutableAttributedString(data: data, options: [NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType, NSCharacterEncodingDocumentAttribute: String.Encoding.utf8.rawValue], documentAttributes: nil) self.textLabel.attributedText = htmlString } It's work

I want native iOS copy and paste UI on UILabel

ぃ、小莉子 提交于 2019-12-23 16:22:47
问题 I want to create the native Copy and Paste experience that iOS provides when you tap and hold a UITextField - but I want it to work on a UILabel instead of a UITextField . Is this possible, or is it something that only works with UITextField ? Would I need to create my own custom UI and mess around in UIPasteboard or is there a more eloquent solution? Here is a typical example, although it normally also shows the zoomed in circle: 回答1: It is difficult to do the standard copy menu on the label

does UILabel have a maximum height?

一个人想着一个人 提交于 2019-12-23 12:56:22
问题 Not too much code to share, just a question. Why is my label invisible if its height is over 8191 pixels? You might think this is way too much and why in the world do i want such a long label... it's dynamic, so you never know. So this is how it goes: I create my UIScrollView and start adding labels in init, 5 of them. I set the text and good to go. I have a method that will take the 5 labels, get the size with the NSString sizeWithFont:constrainedToSize:lineBreakMode: , rearrange them and

How to send text from text field to another view controller

ⅰ亾dé卋堺 提交于 2019-12-23 12:52:00
问题 I'm making an app that behaves something like the default Messages.app in iPhone where a user composes a text message in a UITextField and upon tapping the Send button, the value of the UITextField in ComposeViewController will be transferred to the table cell's UILabel in a custom cell in MasterViewController and also to the DetailViewController where another UILabel will get the text value from the UITextField . The DetailViewController is the ViewController loaded when the user taps the

cornerRadius for UILabel using User Defined Runtime Attributes not working

回眸只為那壹抹淺笑 提交于 2019-12-23 10:28:24
问题 I try to add cornerRadius to UILabel using User Defined Runtime Attributes But it is not working as expected, cornerRadius is not setting and I wonder where I made mistake. I attached screenshot of it, Help me out in solving 回答1: It is layer.cornerRadius not just cornerRadius also you need to set layer.masksToBounds to true . 回答2: Create extension to set corner radius from storyboard public extension UIView { @IBInspectable public var cornerRadius: CGFloat { get { return layer.cornerRadius }

Auto layout of a Child Container that embeds a UIViewController

£可爱£侵袭症+ 提交于 2019-12-23 10:17:50
问题 My main scene shows a child UIViewController , by putting a Child Container in its View, and embedding a child UIViewController in that Child Container. I do that by ctrl-dragging from the Child Container to the child UIViewController in the storyboard , and choosing the "embed" segue. That lets me encapsulate and reuse the child UIViewController elsewhere. I think that is fairly standard. But I can't get it to auto layout properly. I've made a simple test case to demonstrate this: https:/

How can I change a label with a date once the system date changes in iOS?

99封情书 提交于 2019-12-23 09:59:33
问题 I have a simple query but don't know how to do it. This is what I am trying to achieve: 1) I have a UILabel with todays date i.e. "29/04/12" 2) At midnight I want that label to update by itself to "30/04/12" without needing to change view or press anything. It's step 2 that I don't know how to do. I have idea's of how it would be done such as potentially getting a system notification of the date change (if this is even possible) or using some sort of timer as a trigger. Any help would be