ios - Top-aligning text of different sizes within a UILabel -
How to align the text of various sizes within the UILB? For example, small-sized whistle zodiacs are top-aligned with the value-banner equivalent to a large-sized dollar.
IIS6 supports UILB I was able to get my desired results by using a label. By using a little math you can offset the baseline of small text to achieve your desired result. (NSString *) salePrice withFont: (UIFont *) font {if ([salePrice rangeOfString: @ "."]. Location == NSNotFound} {return < [Nmutbited extruded string allocence] Invite string: cellpieces]; } And {nsrange category = [salespricee border offstring: @ "."]; Range.length = (salePrice.length - range.location); NSMutableAttributedString * stylizedPriceLabel = [[NSMutableAttributedString alloc] initWithString: salePrice]; UIFont * smallFont = [UIFont fontWithName: font.fontName Size: (font.pointSize / 2)]; Nsnm * offsetmount = @ (font.capHeight - smallFont.capHyight); [Stylish Prisonlabal Ad Attribute: NSFontetBetName Value: Shortfont Range: Range]; [StylizedPriceLabel addAttribute: NSBaselineOffsetAttributeName Value: OffsetTime Limit: Category]; Back Stylish Pillowlebell; }} It yields the following: NSAttributedString so that I can get the text of different sizes in the same UILBL. Although there is no attribute for top-aligned text. What are the options to implement this? It seems that it may be best to provide custom drawing logic for top-alignment based on a custom string key, but I do not know how it is known about it.
Comments
Post a Comment