uilabel

Blurry UILabel when added programmatically

╄→尐↘猪︶ㄣ 提交于 2019-12-17 23:07:38
问题 I am adding a UILabel to a view meant for loading purposes. However, it gets blurry after I added it. The weird thing is that I just about the same code for an loading view which is loaded ontop of an UITableViewController and it works great there. Yet, this one on top of an UIViewController is blurry. This is my code: float x = (self.view.frame.size.width-20)/2; float y = (self.view.frame.size.height-70)/2; // Add loading and sub text UILabel *loadingText = [[UILabel alloc] initWithFrame

i have NSString value in addViewController and i want to display this value in UILabel of DetailsViewController

谁说胖子不能爱 提交于 2019-12-17 21:23:17
问题 I am newbie to programming. Any help could be greatly appreciated. It's in AddViewController. NSLog(@"Am Currently at %@",locatedAt); DetailsOfPeopleViewController *details=[DetailsOfPeopleViewController alloc]; details.testAddressStr=[NSString stringWithFormat:@"%@",locatedAt]; details.testAddressStr is displaying the value here, but it's not passing this value to DetailsViewController. The value of locatedAt is displaying in the AddViewController. When I try to display this value in UILabel

determine the maximum number of characters a UILabel can take

我只是一个虾纸丫 提交于 2019-12-17 21:05:23
问题 Given a UILabel and a NSString, how do I determine how much of the string can fit inside the UILabel? I am using Xcode-5 and iOS-7. I have been trying to see what I can extract from the thread Calculating UILabel Text Size but I am not getting anywhere with the responses there. 回答1: Well, what I did here works though there may be another, more efficient (yet less straight-forward) way. What I did was just calculate the size of the rect needed for the text, see if it fits in the label's frame,

finding location of specific characters in UILabel on iPhone

北城以北 提交于 2019-12-17 19:46:52
问题 I have a UILabel with some text, say "Hello World abcdefg" The label can have multiple lines, different font sizes etc. Question : How do I find the coordinates of all letters "d" in this UILabel. Logical first step is find the position of those characters in the string (UILabel.text), but then how do I translate that into coordinates when it's actually drawn on screen The idea is to find those coordinates and draw something custom on top of that character (basically to cover it with a custom

Tap Gesture on part of UILabel

浪子不回头ぞ 提交于 2019-12-17 19:46:26
问题 I could successfully add tap gestures to a part of UITextView with the following code: UITextPosition *pos = textView.endOfDocument;// textView ~ UITextView for (int i=0;i<words*2-1;i++){// *2 since UITextGranularityWord considers a whitespace to be a word UITextPosition *pos2 = [textView.tokenizer positionFromPosition:pos toBoundary:UITextGranularityWord inDirection:UITextLayoutDirectionLeft]; UITextRange *range = [textView textRangeFromPosition:pos toPosition:pos2]; CGRect resultFrame =

setting transparent background for UILabel for iphone application

别说谁变了你拦得住时间么 提交于 2019-12-17 19:38:01
问题 I have a UILabel in UITableView. Here is the code i have written in cellForRowAtIndexPath UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithFrame:CGRectMake(30.0, 5.0, 250.0, 35.0) reuseIdentifier:CellIdentifier] autorelease]; } CGRect rect = CGRectMake(30.0, 5.0, 250.0, 35.0); UILabel *label = [[UILabel alloc] initWithFrame:rect]; label.opaque = NO; label.font = [UIFont systemFontOfSize:14]; label

UILabel, UIFont and UTF-8 Triangle

妖精的绣舞 提交于 2019-12-17 19:00:41
问题 I'd like to use "BLACK RIGHT-POINTING TRIANGLE" (U+25B6) as a part of my UILabel 's text. The label uses the system font ( UIFont 's systemFontOfSize: ). The problem is that my triangle is rendered as a fancy image, not a "black right-pointing triangle". Is it possible to see the plain version? 回答1: Based on: Unicode characters being drawn differently in iOS5 iOS 6 supports Unicode 6.1's variation selector , in this case \U0000FE0E . To answer my own question: @"\U000025B6" // a fancy

iOS animating UILabel expand

懵懂的女人 提交于 2019-12-17 18:56:51
问题 I have a UILabel that's initiated with 3 lines of text: locationDescription = [[UILabel alloc]init]; locationDescription.numberOfLines = 3; [locationDescription setTranslatesAutoresizingMaskIntoConstraints:NO]; [self addSubview:locationDescription]; I then have a button that expands the label: - (void)buttonPressed:(UIButton *)sender{ NSLog(@"Pressed"); [UIView animateWithDuration:1 animations:^{locationDescription.numberOfLines = 0;} ]; } The desired behavior for the label is to have each

UILabel Text Not Wrapping

匆匆过客 提交于 2019-12-17 18:13:20
问题 I am working on a Swift project with Storyboards where I want text to wrap in a label. In the old Objective-C version where I did not use a Storyboard I used the following settings and things worked perfectly. Here are the settings for Swift I have been reading about the potential auto layout issues with preferred width settings. I currently have them set to auto layout and the label itself is set to a width of 560. I've added a constraint to keep the label 20 pixels from the trailing

Animating Frame of UILabel smoothly

安稳与你 提交于 2019-12-17 16:39:05
问题 I've been trying to figure out a decent way to smoothly animate a frame size change on a UILabel, without a weird starting jump redraw. What happens by default is that when I do something like this: // Assume myLabel frame starts as (0, 0, 100, 200) [UIView beginAnimations:@"myAnim" context:NULL]; [UIView setAnimationBeginsFromCurrentState:YES]; [UIView setAnimationCurve:UIViewAnimationCurveLinear]; [UIView setAnimationDuration:1.0]; myLabel.frame = CGRectMake(0.0, 0.0, 50, 100); [UIView