Updated 18 December 2016
When we want to show a cutter label in our application, Sometimes there exist an old price of that product or something else and we want that will show the cutter on the price and show the new price . To apply cutter we use the NSStrikethroughAttributeName that will cut the label. After applying cutter on the label, we can show the new label. Example NSStrikethroughAttributeName is :-
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
NSMutableAttributedString *attributeString = [[NSMutableAttributedString alloc] initWithString:"Rs 55"]; [attributeString addAttribute:NSStrikethroughStyleAttributeName value:@2 range:NSMakeRange(0, [attributeString length])]; UILabel *nameLabel = [[UILabel alloc] initWithFrame:CGRectMake((SCREEN_WIDTH/3+5)+5, mainInternalY, SCREEN_WIDTH/2, 22)]; nameLabel.attributedText = attributeString; [nameLabel setTextColor:[UIColor blackColor]]; [nameLabel setFont:[UIFont fontWithName: @"Trebuchet MS" size: 18.0f]]; [paintView addSubview:nameLabel]; UILabel *PRICE = [[UILabel alloc] initWithFrame:CGRectMake((SCREEN_WIDTH/3+5)+70, mainInternalY, SCREEN_WIDTH/2, 22)]; [PRICE setText:[NSString stringWithFormat:@"%@",dict[@"price_with_reduction"][@"text"]] ]; [PRICE setTextColor:[UIColor blackColor]]; [PRICE setFont:[UIFont fontWithName: @"Trebuchet MS" size: 16.0f]]; [paintView addSubview:PRICE]; |
If you have more details or questions, you can reply to the received confirmation email.
Back to Home
Be the first to comment.