Font with a kick through it

I am doing one project handling the tasks of the day, how to take notes.
Therefore, I assign a daily task, and when the task is completed, I want one line to hit the name of the task.
I am looking for a suitable font family that has this end-to-end line, but failed.
so please offer me the .ttf font name for this so that I can use this font in my project to fulfill my requirements.

+2
ios iphone
May 11 '12 at 11:47
source share
5 answers

****** OPTION 1 ******

.

If you want to hit the text in multi-line mode: use TTTAttributedLabel

create new files TTTAttributedLabel.h and TTTAttributedLabel.m (not from GITHUB because I configured one / two strikethrough functions)

http://www.2shared.com/file/Z_qZpWVd/TTTAttributedLabel.html

http://www.2shared.com/file/xXjmC-1M/TTTAttributedLabel.html

and where you need the strikethrough label - use TTTAttributedLabel instead of UILabel .

To set strikethrough =

TTTAttributedLabel *labelName = [[TTTAttributedLabel alloc] init]; labelName.linkAttributes = [NSDictionary dictionaryWithObject:[NSNumber numberWithBool:YES] forKey:@"TTTCustomStrikeOut"]; 

To set doublethrough =

 TTTAttributedLabel *labelName = [[TTTAttributedLabel alloc] init]; labelName.linkAttributes = [NSDictionary dictionaryWithObject:[NSNumber numberWithBool:YES] forKey:@"TTTCustomDoubleStrikeOut"]; 

Add a range in which the text of the label should be crossed out + provide a link with the ability to click (zero, without a link):

 //set link to nil, to NOT-have a link on taping on this label. [labelName addLinkToURL:nil withRange:NSMakeRange(0, [labelName.text length])]; 

PS - to correctly rearrange double lines of outs - edit the TTTAtributedLabel.m file on lines 483, 484 and 489, 490 (I have currently changed the top line y-2 and bottom y + 2 from the center. Tweak to get better results.)

.

****** OPTION 2 ******

.

Convert all string characters to special scroll characters.

You can get them from this homepage: http://adamvarga.com/strike/

Then you can - for example, put the necessary character translations in the language file:

"A" = "A̶"; "B" = "B̶"; "C" = "C̶"; "D" = "D̶"; "E" = "E̶"; "F" = "F̶"; "G" = "G̶"; "H" = "H̶"; ....

and use this function to turn a plain text string into a string striked out:

 - (NSString *)returnStrikedOutTextFromString:(NSString *)mString { NSString * mNewString = @""; for(int i = 0; i<[mString length]; i++) { mNewString = [NSString stringWithFormat:@"%@%@",mNewString, NSLocalizedString([[mString substringToIndex:i+1] substringFromIndex:i],nil)]; } return mNewString; } 

eg:

 textLabel.text = [self returnStrikedOutTextFromString:@"string text"]; 

**** OPTION 3 ****

I would also suggest trying this subclass of UILabel mentioned here: Underline text in UIlabel

Hope this helps!

+5
May 11, '12 at 12:39
source share

Use the code below to scroll the line:

 NSString *string = Yourlabel.text; CGSize stringSize = [string sizeWithFont:Yourlabel.font]; CGRect buttonFrame = Yourlabel.frame; CGRect labelFrame = CGRectMake(buttonFrame.origin.x , buttonFrame.origin.y + stringSize.height/2,                     stringSize.width, 2); UILabel *lineLabel = [[UILabel alloc] initWithFrame:labelFrame]; lineLabel.backgroundColor = [UIColor blackColor]; [CellView addSubview:lineLabel]; 
+2
May 11 '12 at 12:00
source share

If you use another simple idea, its work is beautiful and also very easy ....

just add another maze above your sheet and lable code

 UILabel *canceledlable = [[UILabel alloc] initWithFrame:yourmainlableframe]; canceledlable.opaque = YES; canceledlable.backgroundColor = [UIColor clearColor]; canceledlable.text = @"------------------------------------------------"; canceledlable.lineBreakMode = UILineBreakModeClip; [self.view addSubview: canceledlable]; 

here where you want you to cross out the font, just enter its frame here and add this information when your task is completed I hope this helps you ... :)

+2
May 11 '12 at 12:11
source share

Try this add-on with TTTAttributedLabel.

 @implementation TTTAttributedLabel (Additions) - (void)setStrikeThroughOn:(BOOL)isStrikeThrough { NSString* text = self.text; [self setText:text afterInheritingLabelAttributesAndConfiguringWithBlock:^ NSMutableAttributedString *(NSMutableAttributedString *mutableAttributedString) { NSRange strikeRange = [[mutableAttributedString string] rangeOfString:text options:NSCaseInsensitiveSearch]; [mutableAttributedString addAttribute:kTTTStrikeOutAttributeName value:[NSNumber numberWithBool:isStrikeThrough] range:strikeRange]; return mutableAttributedString; }]; // must trigger redraw [self setNeedsDisplay]; } @end 
+1
May 22 '13 at 1:40
source share

In Swift,

 let label = UITextView(frame: CGRectMake(0, 0, 300, 100)) let strikeThroughAttributes = [NSStrikethroughStyleAttributeName: NSUnderlineStyle.StyleSingle.rawValue] let labelString = NSAttributedString(string: "Hello, playground", attributes: strikeThroughAttributes) label.attributedText = labelString 
0
Dec 29 '15 at 19:50
source share



All Articles