Reputation: 1113
I am using TTTAtributedLabel in my app to make text bold and remaining as it is using custom fonts. Now I want to add some space of 5px between the bold and non bold text. How can I do this? I want to add space after 1.JANUAR 1934.
Thanks in advance.
Upvotes: 0
Views: 209
Reputation: 478
using CTRunDelegate, and add it to your ns-attributed-string,
CTRunDelegateCallbacks callbacks;
callbacks.version = kCTRunDelegateCurrentVersion;
callbacks.getAscent = ascentCallback;
callbacks.getDescent = descentCallback;
callbacks.getWidth = widthCallback;
callbacks.dealloc = deallocCallback;
spaceRunDelegate = CTRunDelegateCreate(&callbacks, NULL);
spacingAttrs = [[NSDictionary dictionaryWithObjectsAndKeys:
(id)spaceRunDelegate,
(NSString*)kCTRunDelegateAttributeName,nil] retain];
//add the attr to your ns-attributed-string
Upvotes: 1