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.

sample image

IIS6 supports UILB 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.

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:



Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -