uilabel

How to make this UILabel move the email address to the next Line?

痞子三分冷 提交于 2020-01-06 14:51:31
问题 I have a simple UILabel that is printing text as follows: John Doe sent a message to blahblah- blah@blahblah.com Thus, the email address here : blahblah-blah@blahblah.com is being cut and partially displayed on the next line. What do I need to do to make it display as : John Doe sent a message to blahblah-blah@blahblah.com ? I already have the following : self.mailLabel.lineBreakMode = NSLineBreakModeByWordWrapping; self.mailLabel.numberOfLines = 0; The string in question is : [NSString

Label in two rows

橙三吉。 提交于 2020-01-06 09:02:56
问题 I have a label in 2 lines in my app but the last word in the first line breaks in two rows. For example if last word is 'home' I have h in the first line and ome in the second. How can I fix that? UPDATE : Put over IB and in code word wrap but without success. Code part: ... cell.leftArticleTitleLabel.lineBreakMode = NSLineBreakByWordWrapping; [cell.leftArticleTitleLabel setLineBreakMode:TRUE]; cell.leftArticleTitleView.frame = CGRectMake(cell.leftArticleTitleView.frame.origin.x, 40, 159, 40)

UILabel causing other objects to reset position on iOS

房东的猫 提交于 2020-01-06 09:00:53
问题 I am learning to program for the iPhone and am making a simple ball bounce game where a ball bounces upward on platforms. The game works and the ball seemingly moves upward when it reaches the top 1/4 of the screen (the platforms on the screen move down, similar to Doodle Jump), however I am having problems when trying to implement a score counter. When the ball reaches the top 1/4 of the screen, I add to the score and run the following two lines of code: NSString *nssScore = [NSString

find out height of a UILabel which is size to fit

≡放荡痞女 提交于 2020-01-06 08:24:31
问题 I am trying to find out the height of the UILabel when the height of the UILabel changes dynamically that is when it is sizeToFit enabled. What is the way to figure out the height of the UILabel? Of course the value frame.size.height is obviously wrong when I enable sizeToFit . Thanks. 回答1: try this it may be help you.. -(CGSize)lblSize:(NSString *)content lblFont:(UIFont *)contectLblFont width:(int)Width { CGSize maximumLabelSize; maximumLabelSize = CGSizeMake(Width,9999); NSAttributedString

UILabel in UIStackView

倾然丶 夕夏残阳落幕 提交于 2020-01-06 08:01:31
问题 While I put a single UILabel into the stack of UIStackView, everything works fine as expected. But what I need is to actually put a UIView under the UILabel and keep the self-size of UILabel to be kept. I just wondering, is there is a way to achieve this without using UITableView and self-sized cell? I used this code let textLabel = UILabel() textLabel.text = "zaciatok TEXTTEXT TEXT TEXT TEXTTEXT TEXT TEXT TEXTTEXT TEXT TEXT TEXTTEXT TEXT TEXT TEXTTEXT TEXT TEXT TEXTTEXT TEXT TEXT TEXTTEXT

UILabel in UIStackView

限于喜欢 提交于 2020-01-06 08:01:10
问题 While I put a single UILabel into the stack of UIStackView, everything works fine as expected. But what I need is to actually put a UIView under the UILabel and keep the self-size of UILabel to be kept. I just wondering, is there is a way to achieve this without using UITableView and self-sized cell? I used this code let textLabel = UILabel() textLabel.text = "zaciatok TEXTTEXT TEXT TEXT TEXTTEXT TEXT TEXT TEXTTEXT TEXT TEXT TEXTTEXT TEXT TEXT TEXTTEXT TEXT TEXT TEXTTEXT TEXT TEXT TEXTTEXT

Label NSMutableAttributedString programmatically swift 4

时间秒杀一切 提交于 2020-01-06 07:16:15
问题 I have to make sure that I can click on the word "Privacy" in order to open a web link. I tried with the suggestions that I found but they are old things and they do not seem to work anymore .. I do not know how I can solve the problem private lazy var firstTermDescriptionLabel: UILabel = { let label = UILabel(frame: .zero) let firstTermsMessage = "I Agree to the License Terms and Privacy Policy" var attributedString = NSMutableAttributedString.init(string: "Privacy") attributedString

How to shrink UILabel spacing between lines without label being clipped?

为君一笑 提交于 2020-01-06 07:01:40
问题 I have a label which I am trying to shrink the spacing in between lines. I tried many things including changing the height multiple, min/max line spacing etc. When I changed the heigh multiple the label seemed to get clipped on top. I'm adding images to show as an example: This is a regular attributed label with default settings. Constraints: Leading 20, trailing 20, align center to Superview and Align Y to superview This is the same label but with the height Multiple set at 0.7 which

adding different UILabel to each cell in UITableView

人走茶凉 提交于 2020-01-06 04:53:06
问题 I'm adding different text to each cell in UITableView. However when I do that, test is displayed in every cell except for the first one..So if theres an array with 9 numbers between 1 to 9, 1 is displayed in the second cell, 2 is displayed in the third cell and respectively. There's nothing shown in the first cell fromHeres the codes // Customize the appearance of table view cells. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static

change string with picture in swift

 ̄綄美尐妖づ 提交于 2020-01-06 04:17:52
问题 I have a String in a UILabel and this string includes one or several emoji but only the name like ":cool:" or ":crazy:". How can I replace the word in the String with the .png ? func checkString(pString: String) -> String { var replaced = pString //get the String var found = "" var image = UIImage() //Emoji for i in 1...bib.count { //bib = array(Int:String) with all names of the Emoji if pString.range(of: bib[i]!) != nil { found = bib[I]! //picBib is a array(String:String) with the Emoji name