uilabel

iPhone how to identify whether UILabels will show truncated text?

做~自己de王妃 提交于 2019-12-13 18:53:07
问题 I need to show a more button on my UILabel when UILineBreakModeTailTruncation starts. ie whenever the " ... " appears, I need to display my more button with some actions. What I am doing is float textWidth = [myString sizeWithFont:myLabel.font].width; if (textWidth > myLabel.frame.size.width) { [moreButton setHidden:FALSE]; } else { [moreButton setHidden:TRUE]; } But my problem is, when the number of lines of the label is set to 2, more button is shown whenever the first line of the label is

prepareForSegue not setting UILabel

会有一股神秘感。 提交于 2019-12-13 18:25:30
问题 I have a prepareForSegue method setup in that sends everything I want to the destinationViewController except the value for a UILabel on the destinationVC . I threw a NSLog statement in to see what value it prints and it prints what I want. It doesn't crash, but it doesn't set. I know I'm missing something very basic here, but it's not jumping out at me. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(UIButton *)sender { if ([[segue identifier] isEqualToString:@"directionsSegue"])

Renaming class causes IBOutlet connection to fail

泄露秘密 提交于 2019-12-13 15:24:12
问题 I renamed a class, which happened to have an outlet connection to a label called mainLabel in a storyboard file. When I run my program, it crashes and gives me the error: "this class is not key value coding-compliant for the key mainLabel". Other SO answers have shown this to be caused by a bad outlet connection, so I removed the connection and removed any lose ends. When trying to reconnect the label to an outlet in my code, I get the error Could not insert new outlet connection: Could not

Rotating UILabel at its center

元气小坏坏 提交于 2019-12-13 12:19:52
问题 I am trying to rotate a UILabel at its center, but when it rotates it changes its position. It doesn't stick to its center. I am using following code to rotate it: float fromAngle = atan2(m_locationBegan.y-lblText.center.y, m_locationBegan.x-lblText.center.x); //float toAngle = atan2(_location.y-lblText.center.y, _location.x-lblText.center.x); float toAngle = atan2(_location.y-lblText.center.y+5, _location.x-lblText.center.x+5); float newAngle = wrapd(m_currentAngle + (toAngle - fromAngle), 0

uilabel with outline or stroke [duplicate]

前提是你 提交于 2019-12-13 11:49:45
问题 This question already has answers here : How do I make UILabel display outlined text? (14 answers) Closed 4 years ago . I was wondering how can I create text stroke for UILabel ? is there any possible way ? thank you , #import <Foundation/Foundation.h> @interface CustomLabel : UILabel { } @end #import "CustomLabel.h" @implementation CustomLabel - (void)drawTextInRect:(CGRect)rect { CGSize shadowOffset = self.shadowOffset; UIColor *textColor = self.textColor; CGContextRef c =

How to pass data between view controllers - not working

南笙酒味 提交于 2019-12-13 10:56:25
问题 Im trying to pass an player score from VC1 to a view that displays the current scores of all players(4). the display view is on a separate view controller than where the player(s) score is defined and stored. I have done the prepare(segue) and im able to pass other variables to the display VC(ThirdViewController). but when I try to assign the player score to the uilabel.text It tells me that I have unwrapped a nil value I have even tried to just set the label text to a static string and still

Identify different iOS devices in coding? [closed]

南楼画角 提交于 2019-12-13 10:37:40
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . I know the in objective-c, there is a way to know which device the user is using. But I really a new of iOS development, I do not know those complex and complicated command in objective-c. Could any one tell me how to identify the phone model by coding. Also, if I can know which device the user is using, is that

Swift Error - “Unrecognized selector sent to instance”

本小妞迷上赌 提交于 2019-12-13 10:35:47
问题 I am working on a Swift project in Xcode v6.1.1, and I am getting the following error that I don't understand. I believe there is a problem with a couple of the Labels in my Main.storyboard and/or the UILabel variable I have them connected to. I have tried everything I can find to fix it, and nothing has worked. Any help would be appreciated. 2015-03-02 19:43:14.854 Final Project[7380:250494] -[UILabel longValue]: unrecognized selector sent to instance 0x7b8e1810 2015-03-02 19:43:14.876 Final

iOS Clickable Words (UILabel or UIbutton's)

你。 提交于 2019-12-13 08:42:26
问题 I'm wanting to create a read only text area in my app which allows the user to click on any word and the app reads it out. I am however a little confused on which method would be the best. I see two options, use a UILabel and create some method to detect the region clicked then match it to the word in that region but it sounds hard to implement. On the other hand I could use an array of words to create a list of UIbutton's. Any advice and/or sample code to help me would be much appreciated,

Changing the text color of UILabel in UITableViewCell

匆匆过客 提交于 2019-12-13 08:37:40
问题 I am required to change the text color of the UILabel which is contained in the UITableViewCell on a button click. I have created a UIColor object , which is set to specified color on the button click and called the UITableView reloadData method, even then the color is not changing. How should I implement this? 回答1: I assume that you want to change the color of all rows in your table. (If you just want to change a single row, you will need its indexPath ). Create a BOOL variable that keeps