FAQ Database Discussion Community
ios,xcode,function,swift,uilabel
I am wondering if anyone knows how to (if possible) pass a UILabel through a function while being able to access and change its properties? Here's what I have: func plusMinusChange(minus: UILabel, plus: UILabel) { if (minus.hidden) { minus.hidden=false plus.hidden=true } else { minus.hidden=true plus.hidden=false } } And here's how...
ios,objective-c,uilabel
Current result: I'm able to adjust the size of the label by calling sizeToFit, which does a decent job at framing the text -- however, even with NSTextAlignmentCenter, the text is not exactly centered horizontally or vertically. To adjust the text positioning within the label, I've overridden drawTextInRect: to adjust...
ios,uitableview,swift,uilabel
I have a table that loads data from a database but the problem is if the text being loaded is too long, it goes off the screen. I'm trying to find a way for the text to go onto the next line and have the cell resize automatically to fit...
swift,uiview,uicollectionview,uilabel,uiviewanimation
I have 2 View Controllers. The first one is a Collection View Controller, the second a plain View Controller. When clicking a cell in the Collection View Controller, the second View Controller appears. When the view starts to load in the 2nd view controller, I want to show a UILabel...
ios,ios7,uilabel
I have aUILabel which I want to update. If I will login with a user name then the UILabel will be updated with that user name,which it is doing correctly and storing the value. Now I want whenever i will logout then the UILabel text should return the previous value...
ios,uilabel,sizetofit,sizewithfont,tttattributedlabel
I am using TTTAttributedLabel and I usually use sizetofit in my tableview cell. After that, I use sizeWithFont in my cell height calculation. I set TTTAttributedLabel like this. [self.attributedLabel setText:@"Test\n\n\n\n"]; CGSize contentSize = [self.attributedLabel.text sizeWithFont:self.attributedLabel.font constrainedToSize:CGSizeMake(CGRectGetWidth(self.attributedLabel.frame), 1000) lineBreakMode:NSLineBreakByWordWrapping]; [self.attributedLabel sizeToFit]; I notice that height is different. I got my output...
ios,objective-c,swift,uilabel,clickable
The idea is for example there is a UILabel (like in Instagram) "User1 started following User2" I want that when we click either on chunk of text 'User1' or 'User2' it does some action(Not opening like usual link in UIWebView) Tried TTTAttributedLabel , didn't find anything which will fit me...
ios,uilabel,uigesturerecognizer,touchesbegan
I have a problem, In my app I have a Label and when I touch on it a method is fired, I implemented with -(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event, the problem is that when I touch, the method is fired (everything is working) but I want when I touch once again...
swift,uilabel
I created a navigation controller with a view controller inside, containing a label. This label should be changed, when the view controller is loaded on tapping a button. class ViewController: UIViewController { @IBOutlet weak var btnEmergency: UIButton! override func viewWillAppear(animated: Bool) { self.btnEmergency.backgroundColor = UIColor.redColor(); } override func viewDidLoad() {...
ios,uiview,autolayout,uilabel,multiline
I would like to accomplish what is seen in the image below in Interface Builder. Basically two labels - one multi-line and one note - inside a view and the view centered horizontally on the page. So to be clear, I cannot put a width constraint on the view or...
ios,uiview,uiimageview,uibutton,uilabel
If I declare a UILabel and a UIImageView of different sizes can I then center them in a UIView with 10.0points between the two horizontally? Thanks!...
ios,uilabel,core-text,hyphenation
Example: My text is @"This is a great UI/UX feature". A better example: @"5/17 of this quantity". Is it possible to force the line NOT to break at the / (the slash)? I'm looking for a general way of doing, since I have others sentences with slashes....
ios,objective-c,iphone,uilabel
I want to add gradient effect on a UILabel so it look like: Please note the gradient effect on left and right corner.I've no clue how to do that.any help or suggestion would be appreciated. Edit: - I tried with this code- UIColor *endColor = [UIColor colorWithRed:20/255.0 green:157/255.0 blue:189/255.0 alpha:1.0];...
ios,objective-c,uilabel
I am having a user enter in text through text field and then display it in a label in a separate ViewController. Basically what I need to happen is 1 - Have the user enter in text 2 - The second ViewController creates and assigns the the text to a...
ios,xcode,swift,uilabel
If the text of a label in a universal storyboard is too long to fit some resolutions, how do I accommodate it? Storyboard View iPhone 6 Emulator I'm not sure if there is a proper way to go about this according to the guidelines, but I would assume I would...
ios,swift,uilabel,nslayoutconstraint
It seems impossible to get the UILabel to adhere to the constraints in the way that I want it to consistently. The leading and trailing space constraints seem in effect but the label is just truncating the lines instead of expanding to new lines. I do have the numberOfLines of...
ios,uilabel
I am trying to blur the text of UILabel without image blurring methods. I found many solutions but maximum are there for images. I tried shadow functionality of layer but that is not helpful.
ios,swift,uilabel,uitextview
So I'm trying to create a view where part of the entered text becomes a link to another UIView. I was searching a lot and found the ClickableSpan class that enabled to click on part of the text. It's like in Instagram where when a user types @username or #hashtag...
ios,objective-c,uilabel,wrap,word
I have a UILabel set up to have a maximum of 2 lines, that word-wraps when there is too much content. I have a problem where when there is only a single word left over, it doesn't bother to wrap and truncates the text. how can I get it to...
ios,objective-c,uilabel,subclass
I'm looking to create a standard look and feel within my App, where some UILabel have a specific textColor. I have several UILabel on my UIViewController, and in the viewDidLoad method I'm calling a function that sets the textColor property: [[CHToolKit sharedToolkit] uiLabelAppearanceFeatured:[self IBOLabelStepsRemaining]]; CHToolkit is a singleton I created...
ios,objective-c,uilabel,core-animation
I have a UITextfield in a UIView that contains some default text. I want to animate the scaling of this textField (along with the parent UIView) %300, and later back down to 100%. How do I do this? It seems everything I've found involves a hacky image capture and a...
ios,swift,view,uilabel,center
I want to horizontally center multiple UILabels - as a group - on a line in Interface Builder. One the straight view controller i could not figure out how to do this. I read comments about place the UILabels in a View and then centering the view in the view...
ios,objective-c,uilabel
I have a UILabel with multi lines. I'm trying to get the text to auto size, and fit on the line it's in. So instead of: longe st The text size should become smaller so that it can fit on the same line: longest Note: I only need it for...
ios,objective-c,uilabel
I have some text in a UILabel. I want to get the text of the first label in a string variable. For example: label.text = @"You make an object by creating an instance of a particular class. You do this by allocating the object and initializing it with acceptable default...
ios,swift,uibutton,uilabel
How can you rotate text for UIButton and UILabel? 90 degrees, 180 degrees Note: Before you mark this as a duplicate, I am intentionally modelling my question as a Swift version of this one: Objective C: How can you rotate text for UIButton and UILabel?...
ios,objective-c,swift,uitextfield,uilabel
In my application i have one UILabel and UITextField. Initially UILabel text in nil. As soon as user enter some text in UITextField my UILabel text also Update. Let say When user enter A in UITextField my UILabel immediately show A, B in UITextField my UILabel show B and so...
ios,objective-c,object,uilabel
I have some object with 18 properties (number of properties in that object is static and do not change over the time). Each property stores some information. I need to create a UILabels in cycle (for, foreach, etc.) and set current object.property to current label. How I can do that?
ios,iphone,xcode,uiview,uilabel
How do I vertically (y-axis) center a UILabel inside its parent UIView without changing the horizontal position of the UILabel? The following is not it (it changes the x-axis): [self.label setCenter:CGPointMake(view.frame.size.width / 2, view.frame.size.height / 2)] Again, I am looking to center along the y-axis....
ios,swift,oop,model-view-controller,uilabel
I have a Model class, which has two methods: func callElements() -> String { if(count < elementsToShow.count - 1) { count += 1 var element = elementsToShow[count] println(element) return element } else { return "No more buttons" } } func changeLabel(){ var callV = ViewController().label var elementCall = callElements() println("111")...
ios,objective-c,uilabel,viewdidload
I change the value of 2 UILabels in my "viewDidLoad" method, but I need the view to refresh after that in order to display the values. As it currently stands, the UILabels display the value of the previously selected cell. I need to do the refresh right after I change...
swift,ios8,cursor,uitextfield,uilabel
i need to insert a cursor in the text .. i don't want a textField (user don't type in it) .. i just need the cursor itself . so i can put it manually wherever i want .. like button's title . or UILabel .. I tried to just type...
ios,objective-c,uilabel,nsdate,updates
Set a date in UILabel. The click on "next" and "previous" buttons should change date inside this label. I'm trying this code but next button click and show date next day date for e.g 01/05/2015 and previous button click and set date 29/05/2015 and next button click not display 02/05/2015...
ios,uitableview,autolayout,uilabel
I'm trying to create dynamically resizing table view cells. I accomplished the resizing by using this answer, which is very detailed and helpful. However, the maximum width for the label is not being calculated correctly inheightForRowAtIndexPath. My cell currently only has one label in itscontentView, with constraints set to pin...
ios,uilabel,subview,unicode-string
I am seeing a strange behavior of UILabel and its subview on iOS development. I want to have a overlay view on the UILabel and want to change only the text of the label. It works well when the text is digits or alphabets. However when I changed the text...
ios,objective-c,uilabel,nsparagraphstyle
Can you explain me why NSLineBreakByWordWrapping sometimes not working? It's tableView NSMutableParagraphStyle *paragrahStyle = [[NSMutableParagraphStyle alloc] init]; [paragrahStyle setLineSpacing:4]; paragrahStyle.lineBreakMode = NSLineBreakByWordWrapping; //Char [[cell titleLabel] setAttributedText:[[NSAttributedString alloc] initWithString:((Post *)posts[indexPath.section])->title attributes:@{NSParagraphStyleAttributeName : paragrahStyle, NSFontAttributeName : [UIFont fontWithName:@"Roboto-Condensed" size:24.0f]}]]; ...
ios,uilabel
I am looking for the best way to create a label with the close button in it. Do I need to place a button in the label or can i use the label as a button?
ios,objective-c,uiview,uilabel
This question already has an answer here: How to set gradient color to the background of UILabel in iPhone 1 answer I wanna fade the background color of UILabel. For example : from dark blue to light blue(just static display). How can I implement it?...
ios,nsstring,uilabel,nsattributedstring
I need to display a string which will change every second. For example : View will refresh in 10 sec View will refresh in 09 sec View will refresh in 08 sec View will refresh in 07 sec .. View will refresh in 0 sec The above string needs to...
ios,json,uilabel
My json Response is like this .. { sentdetails = ( { coursename = "Course Two"; createddate = "05/12/2015 06:13 AM"; currentprice = "2.00"; "no_of_files" = 9; queryid = 36; querystatus = Open; submissionid = TSAb13d585e; testsaviornotes = None; title = Test; usernotes = rdgbv; } ); status = Sucess;}...
ios,iphone,xcode,swift,uilabel
Long time reader, first time poster. I have searched all over for a solution but I am yet to find an answer that works. Ok the problem: I have a UILabel which gets text dynamically assigned to it. If I resize the label to cover the entire view controller the...
ios,uitableview,autolayout,uilabel
I have two UILabel views next to each other in an UITableViewCell. The left one has one line, the right one can have multiple lines and uses whatever horizontal space that is left. Both labels have the same distance from the top of the cell. The height of the cell...
ios,uilabel,nsattributedstring
I have a multiline label that will contain an attributed string. This is the code of the attributed string: NSString * titleString = @"Title"; NSString * informationString = self.myObject.content; NSString * allString = [NSString stringWithFormat:@"%@\n\n%@",titleString,informationString]; NSMutableAttributedString* attributedMessage = [[NSMutableAttributedString alloc]initWithString:allString]; NSMutableParagraphStyle* style=[[NSMutableParagraphStyle alloc]init]; style.alignment = NSTextAlignmentLeft; NSDictionary *attributesTitle =...
ios,swift,uilabel,nsurl
I wanted to know if it's possible to load the text in a label from a URL. I was going to try and use NSURL to pull in a .txt file stored online. Would anyone know how to implement this with swift? Thanks...
swift,uikit,uilabel
I have a UILabel with an NSAttributedString with the following code: // just creating from a notification.mainCopy! var myMutableString = NSMutableAttributedString(); myMutableString = NSMutableAttributedString(string: notification.mainCopy!, attributes: [NSFontAttributeName:UIFont(name: "Helvetica", size: 14.0)!]) // a notification will have a blueMainCopy1 - just a test so no this could be done better // How...
ios,objective-c,animation,uilabel,alpha
I have some UILabels on a view that I want to fade when the someone is holding down on the view. I am trying to perform the fade by changing the alpha value of the text from 1.0 to 0.5 and then back again when the touch is released. Here...
ios,storyboard,uilabel,nslayoutconstraint
I have an UILabel, created in Universal storyboard, and I have mentioned all required constraints for its position OTHER THAN WIDTH. So it resizes itself as per the text set. Fantastic! Exactly what I want. Problem starts here : It has background color as green color, but that color is...
ios,objective-c,uilabel
So I have a UILabel that may or may not go to a second line, depending if it is on iPhone or iPad. What I would like to accomplish is to have it indent on the second line to line up correctly, if needed. On iPad it will almost never...
objective-c,uilabel,pushviewcontroller
I've been searching for passing label data to another view controller, and found the following solution. However, it doesn't show the label text in another view controller. please help SecondViewController Header @interface SecondViewController : UIViewController { IBOutlet UILabel *copy; } @property (nonatomic, retain) NSString *data; In SecondViewController Implementation copy.autoresizingMask =...
xcode,swift,uilabel,segue
I'm currently getting a fatal error unexpectedly found nil while unwrapping an optional value at destViewController.titleLabel.text = "Testing Segue". How do I fixed it since it getting me a error when it segue to SecondViewController? How do I avoid getting nil at titleLabel.text? class ViewController: UIViewController { @IBAction func action(sender:...
ios,objective-c,iphone,fonts,uilabel
I am using Autoresizing for UILabel on the xib. And when i launch app on iPhone4/5 UILabel font looks perfect but for iPhone6/Plus font looks very small. I referred so many link including Adjusting font size according to device screen and Category for UILabel Also the adjustsFontSizeToFitWidth is not working...
ios,swift,uiimageview,uitextfield,uilabel
I've been trying for a long time to find the best way to add a UILabel with its background color to a UIImage. I need to add a exact replica of the label that is being shown on the screen to the image, if that makes sense to you. The...
ios,swift,uilabel
in my app I want to set the text of an UILabel. The text comes from a JSON-object. I add my UILabel to my storyboard, set the IBOutlet and call my async-method to get my JSON-object. In the response-method I set the text of the UILabel. But the text change...
ios,uilabel,nsattributedstring
Is it possible to limit the distance between paragraphs that were created using \n\n smaller in UILabels using attributed strings? So for example, I would like this: To look like this: Would this involve replace \n\n with something else? Or is there a much simpler solution using NSAttributedString?...
ios,objective-c,uilabel
I tried subclassing UILabel with the following code.. but unable to get a look similar to - (void) drawRect:(CGRect)rect { CGSize myShadowOffset = CGSizeMake(4, -4); CGFloat myColorValues[] = {0, 0, 0, .8}; CGContextRef myContext = UIGraphicsGetCurrentContext(); CGContextSaveGState(myContext); CGColorSpaceRef myColorSpace = CGColorSpaceCreateDeviceRGB(); CGColorRef myColor = CGColorCreate(myColorSpace, myColorValues); CGContextSetShadowWithColor (myContext, myShadowOffset, 5,...
ios,uilabel,uifont,monospace,ios9
In this years WWDC there was a session about the new system font SanFrancisco in iOS 9 which uses proportional number rendering instead of monospaced numbers per default when linked against the iOS 9 SDK. There is a convenient initializer on NSFont called NSFont.monospacedDigitsSystemFontOfSize(mySize weight:) that can be used to...
ios,swift,uilabel
So I have this routine that sets different text uilabel.text values self.addressLabel.text = firstObject["ADDRESS"] as? String self.phoneLabel.text = firstObject["PhoneNums"] as? String self.latitude.text = firstObject["LAT"] as? String self.longitude.text = firstObject["LON"] as? String but when I try to print out println("\(latitude.text!)") It outputs: Label How can I make it so that the...
ios,objective-c,uilabel
Text: 【233 24444 2223】【233 24444 2223】【233 24444 2223】【233 24444 2223] I want to break the text in a UILabel From: 【233 24444 2223】【233 24444 2223】【233 24444 2223】【233 24444 2223】 To: 【233 24444 2223】【233 24444 2223] 【233 24444 2223】【233 24444 2223】 In another word,I want to tell the UIlabel that the...
ios,swift,uilabel
I have a UILabel with more than one line: let serviceDescription: UILabel = UILabel() serviceDescription.text = "some very long text..." serviceDescription.numberOfLines = 0 serviceDescription.sizeToFit() self.contentView.addSubview(serviceDescription) Then I add some autolayout constraints: serviceDescription.snp_makeConstraints { (make) -> Void in make.top.equalTo(self.contentView_snp_top).offset(24) make.left.equalTo(self.contentView).offset(20) make.right.equalTo(self.contentView).offset(-20) } Now I want to compute the size this label...
ios,objective-c,uilabel,cashapelayer
I want to add background line in multiline label using NSAttributedString in objective-c as shown in image below I used following code [yourView.layer setBorderWidth:5.0]; [yourView.layer setBorderColor:[[UIColor colorWithPatternImage:[UIImage imageNamed:@"DotedImage.png"]] CGColor]];///just add image name and create image with dashed or doted drawing and add here But it doesnt work perfectly and I...
ios,uilabel
This question already has an answer here: Any way to bold part of a NSString? 5 answers I have an iOS UILabel that needs some of the text to be normal and some of the text to be bold. The bold text is actually supposed to be a link...
ios,swift,uibutton,uilabel
I try to wrap a text on a button as follow: nextButton=UIButton(frame: CGRectMake(buttonHWidth, textHeigth, buttonHWidth, buttonHeigth)); nextButton.backgroundColor = UIColor.lightGrayColor() nextButton.setTitle("", forState: UIControlState.Normal) nextButton.addTarget(self, action: "buttonAction:", forControlEvents: UIControlEvents.TouchUpInside) nextButton.tag = 22; label_nextButton = UILabel(frame: CGRectMake(buttonHWidth, textHeigth, buttonHWidth, buttonHeigth)); label_nextButton.textAlignment = NSTextAlignment.Center;...
ios,swift,uilabel
I notice when I'm writing in Swift, if I declare a label in the ViewController as either var label: UILabel! or var label = UILabel(), and then initialize them in the viewDidLoad method, they both seem to, functionally, work identically. So what is the difference between these two? On a...
swift,uilabel,watchkit,wkinterfacelabel
I'm developing an apple watch app - it consists of two tables that contain labels. These labels have two lines of text, I want the second line of text to have a different font style to the top line How can I do this in swift? Thanks everyone...
ios,objective-c,uilabel,nsattributedstring,nsrange
I have a UILabel that contains text like this: "Hi, my name is John Smith. Here is my twitter handle @johnsmith and I work for this company @somerandomcompany. Thanks for watching!" I need to find the ranges for all of the @ symbols and whatever text comes right after them...
ios,objective-c,uiview,uilabel,uinavigationbar
I am using following code to align 2 strings in UINavigationBar centre . for ex: <Back John Kelly Maria 23/F I need these kind of middle aligned text in UINavigationbar but what jam now getting is all the text aligned in right side of UINavigationBar . something like this <Back...
xcode,uilabel
I am trying to set a text in UILabel, like this mylabel.text = @"▶ section1"; but, the right arrow character is translated to audio player icon inside UILabel. Is there a way to print right arrow character intactly as it is. Thank you....
ios,objective-c,uitableview,uilabel
This is really frustrating me. I notice there are a lot of questions regarding this but I can't seem to get any of it to work. I have tried UILabel. I have tried UITextField (which works to a certain extent but some of the text doesn't get resized all the...
ios,swift,uilabel
I am trying to do something fairly simple, but I can't get it figured out. I have a label that is populated based on an alert controller action. I am trying to create an alert that will pop up if the user did not select an option to populate the...
ios,objective-c,integer,uilabel
I think I need some help. In my App, I do have a UILabel, whose text is coming from an "integer". Whenever the View loads, it gets the actual in NSUserDefaults stored value for the integer: NSUserDefaults *defaults = [[NSUserDefaults alloc] initWithSuiteName:@"group.sam.Widget"]; counter = [defaults integerForKey:@"MyNumberKey"]; numberLabel.text = [NSString stringWithFormat:@"%d",...
ios,objective-c,uiscrollview,uilabel,frame
I have downloaded this project that show a small example regarding paging: Paging example project And I have added a label and by using the scrollViewDidScroll: delegate method that is called when any scrolling action takes place I call a method that resets the x position of the label aded...
ios,objective-c,uitableview,uiview,uilabel
I have a table view with a custom protoype cell and the cell has 3 different labels on it. How do I get access to these labels? I need to change their texts. I've searched around everywhere and haven't found something that helps me in this case. I have the...
ios,objective-c,xcode,uilabel
I segue to a UIViewController, and during its init method, 2 labels' text is supposed to be specified. However, that doesn't happen and the text never changes. All the connections are right, but they aren't displaying anything, and I can't figure out why. Below is the code that is supposed...
ios,uibutton,uikit,uilabel
I am trying to figure out how to only display a label while a button is pressed in OS. I know how to operate the touch events but I am not sure how to incorporate the UILongPressGestureRecognizer into this.
ios,swift,uilabel
I want to hide my IBOutlet. However, setting text to empy string works perfectly fine, but when I acces directly my IBOutlet I keep getting error that "unexpectedly found nil while unwrapping optional value". I tried setting my IBOutlet to local varialble, but it gives error as well. I prepared...
ios,objective-c,uilabel,uianimation
Actually i am using RESlider in my app. In the menu table view there is a profile image and aside to it there is a notification label. Now i want is that when the user presses the hamburger menu the notification label(orange label with 999 number) should animate from a...
ios,swift,uilabel,tableviewcell
I am creating a chat based app, which uses a UITableView to hold all the messages within a conversation. To create a chat bubble, I have a wrapper view (wrapView) which is constrained to the top, bottom, right, and left of the TableViewCell. As a subview I have a UILabel...
swift,uibutton,uilabel,nil,ibaction
I am having trouble with my UIButton. For Example, when I click the the UIButton Number3 and hit the checkButton on the ViewController the result in the currentCountLabel is Optional(3). It does this for every number after I click the checkButton. If I then click the button again, the currentCountLabel...
ios,objective-c,uilabel,uiedgeinsets
I´m using HTMLLabel (https://github.com/nicklockwood/HTMLLabel) and i would like to implement some insets. So i wrote in the HTMLLabel.m file: - (void)drawTextInRect:(CGRect)rect { UIEdgeInsets insets = {0, 5, 0, 5}; [super drawTextInRect:UIEdgeInsetsInsetRect(rect, insets)]; } But the method never get called, any ideas why? Thanks for your help!...
ios,fonts,uilabel,font-size
I need to fit a multiline attributed text in a UILabel's frame. Reading this thread How to adjust font size of label to fit the rectangle? I started from Niels' solution in order to work with attributed text. Here's the code: the 't' of 'prospect' is put in a new...
objective-c,xcode,uilabel,uiswipegesturerecognizer,swipe-gesture
I have been trying to come out a solution for using swipe gesture to the right and makes the text on a label.text with strike through effect, swipe again to remove the strike through and leaves the original text intact. Any example of codes as to how to do this?...
ios,objective-c,uilabel,uistoryboard,nslayoutconstraint
I have an UILabel, it has background color as green. But It wraps the text very closely. I need the green background to be little wider than the text, approx 5 points. How can I achieve this? Details Label is created in storyboard and has horizontal spacing constraints. You can...
objective-c,uilabel,uicollectionviewcell
I try to make a custom UICollectionViewCell in storyboard. I have CustomCell.xib, CustomCell.h and CustomCell.m. In the .xib the Classname is linked and the identifier is set to "cell". The .xib contains 1 UIImage and 2 UILabels, all having IBOutlets to the .h class. In the ViewController where I'm using...
ios,objective-c,timer,uibutton,uilabel
I'm a new in iOS Development and I am writing an app that has a countdown timer. I want the user to be able to tap on the time to set it so I used a UIButton as that seemed the easiest thing. I've seen questions on this site about...
ios,swift,uitableview,uilabel
I just wonder why a UILabel in UICell gets truncated despite the fact that it would actually fit there. I know that accessory indicator takes some space but this is not the point, from what I can see in my storyboard the uilabel would fit there easily. My constraints aren't...
ios,autolayout,uilabel,vertical-alignment,baseline
I have a parent UIView where I place two labels on it. Each of these labels only has one line as can be seen here: The problem now is that the baseline is wrong. I'm using auto layout and the question is how should my constraints should look like in...
ios,uitableview,swift,autolayout,uilabel
Aim: To display a multiline label on a custom cell in a UITableView using autolayout and UITableViewAutomaticDimension. The cell should vary based on the text in each UILabel. What I have done: Used auto layout tableView.rowHeight = UITableViewAutomaticDimension tableView.estimatedRowHeight = 100 label.numberOfLines = 0 (label is the new label I...
objective-c,xcode,uilabel
I have a bit of a strange problem. I have a UITableView controller. Inside the UITableViewCells are four profile images for the user and below each picture is a UILabel to display the name. All the labels are the same size and all the constraints are equally set up. The...
ios,iphone,swift,uilabel
In my app I have a label which text came from the server so I don't Know its width, and at the end of this label directly there should be an UIImage. My problem is: I don't know how to position the image because of the non static width of...
ios8,nsstring,uilabel,uifont
I have found that a call to boundingRectWithSize is extremely incorrect, missing an entire additional line, when called with NSFontAttributeName : [UIFont preferredFontForTextStyle:UIFontTextStyleBody]. However, using the font [UIFont fontWithName:@"Helvetica Neue" size:17.f], it is just fine. Here is test code showing the bug: - (void)viewDidLoad { [super viewDidLoad]; NSString *measureText =...
ios,uitableview,autolayout,uilabel
I have UILabel in a UITableViewCell whose neighboring subview is UIControlSwitch. When the UIControlSwitch is hidden, the UILabel's width is expected to grow. Below is my custom class implementation: - (void)setBounds:(CGRect)bounds { [super setBounds:bounds]; self.contentView.frame = self.bounds; } - (void)layoutSubviews { [super layoutSubviews]; [self.contentView updateConstraintsIfNeeded]; [self.contentView layoutIfNeeded]; self.numberLabel.preferredMaxLayoutWidth = CGRectGetWidth(self.numberLabel.frame);...
ios,autolayout,uilabel
I have two multiline UILabels. The parent UIView only has a certain size (height) but the labels can contain a long string. What I want is that the first label is always shown (e.g. abbreviated with ... if it gets too long). If there is room the second label should...
objective-c,uilabel,tableviewcell,swrevealviewcontroller,viewwithtag
I've created a table view controller on storyboard. I want to change UILabel text color to green when i clicked on the selected row. I'm trying something like this, but it's not working: - (void)viewDidLoad { [super viewDidLoad]; menuItems = @[@"home", @"stamp", @"scanner", @"settings"]; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath...
ios,objective-c,uiview,uilabel
I am trying to load a UIView from nib and place it as the 'header' for a UICollectionView using the following code inside the view controller's viewDidLoad: self.collectionView.contentInset = UIEdgeInsetsMake(220, 0, 0, 0); self.overView = (OverviewView *)[[[NSBundle mainBundle] loadNibNamed:@"OverviewNib" owner:self options:nil] objectAtIndex:0]; [self.overView setFrame:CGRectMake(10, -210, self.view.frame.size.width - 20, 200)]; [self.collectionView...
ios,objective-c,uilabel
In my iOS app, I'm trying to set the text of a UILabel in another view. I do this by passing a NSNotification to the viewController when it should be updated. I know it is receiving the message correctly because I log the message, but it just isn't appearing in...
ios,uibutton,uilabel,watchkit
I created a sample watchkit app and I dragged a UIButton and UILabel into the storyboard app scene. I was able to hook up the UIButton to the interface controller and got it to update the UILabel. But the label.text was not reflected in the simulator. Nothing changes. Do I...
ios,objective-c,xcode,swift,uilabel
I'm trying to set the value of the cell to a text value of a label that I place in the Main.storyboard, however after updating to Xcode 6.2 it start giving me an error that "UILabel doesn't have a member named text" before the update everything was working fine. this...
ios,objective-c,uilabel,nsattributedstring
I'm trying to change a UILabels first line's color. It's not working for some reason. Here is my code: NSMutableAttributedString *text = [[NSMutableAttributedString alloc] initWithAttributedString: label.attributedText]; [text addAttribute:NSForegroundColorAttributeName value:[UIColor redColor] range:[label.text rangeOfString:@"\n"];]; [label setAttributedText: text]; I don't see any changes in the first line....
ios,objective-c,uiview,uilabel,uitouch
I have a Label named "Lable_Match" (in self.view) and a UIView(in self.view). In that View there are 1000+ labels. and view is move using touch move method. and When user move View and he touch end that time check view subview lable is on the "Lable_Match" if any one lable...
iphone,swift,ios8,uilabel,synchronous
I'm trying to update a couple UILabels in my view, but I'm hitting a delay in the updating. I'm creating an NSURLSession, which I don't know if that's what's causing the problem, but I'm able to update other UILabels outside this chunk of code without any delay. When this code...
ios,objective-c,xcode,uilabel,uipickerviewcontroller
I'm trying to change though a timer in a different method the text of a label I created programmatically in a UIView overlay that goes on a UIImagePickerviewController, but of course when I try to change the text in this way labelname.text = @"TEST"; I get the error "use of...