{"id":37741,"date":"2022-11-28T16:59:44","date_gmt":"2022-11-28T21:59:44","guid":{"rendered":"https:\/\/mjtsai.com\/blog\/?p=37741"},"modified":"2022-11-28T16:59:44","modified_gmt":"2022-11-28T21:59:44","slug":"textkit-custom-truncation","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2022\/11\/28\/textkit-custom-truncation\/","title":{"rendered":"TextKit Custom Truncation"},"content":{"rendered":"<p><a href=\"https:\/\/www.amyworrall.com\/blog\/textkit-custom-truncation\">Amy Worrall<\/a>:<\/p>\n<blockquote cite=\"https:\/\/www.amyworrall.com\/blog\/textkit-custom-truncation\">\n<p>TextKit has the option to truncate the last line of text if there&rsquo;s more text than will fit in the container. It does this by displaying an ellipsis. But what if you wanted to display something else to indicate truncation? (In my case, the string &ldquo;See More&rdquo;, which will function like a button.)<\/p>\n<p>I tried and discounted a bunch of different approaches before coming up with something that worked. Let me take you on the journey.<\/p>\n<\/blockquote>","protected":false},"excerpt":{"rendered":"<p>Amy Worrall: TextKit has the option to truncate the last line of text if there&rsquo;s more text than will fit in the container. It does this by displaying an ellipsis. But what if you wanted to display something else to indicate truncation? (In my case, the string &ldquo;See More&rdquo;, which will function like a button.) [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"2022-11-28T21:59:47Z","apple_news_api_id":"8ae98881-ddd5-40b3-a679-232e6eef6e5a","apple_news_api_modified_at":"2022-11-28T21:59:47Z","apple_news_api_revision":"AAAAAAAAAAD\/\/\/\/\/\/\/\/\/\/w==","apple_news_api_share_url":"https:\/\/apple.news\/AiumIgd3VQLOmeSMubu9uWg","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[4],"tags":[69,31,2185,30,2223,71,591],"class_list":["post-37741","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-cocoa","tag-ios","tag-ios-16","tag-mac","tag-macos-13-ventura","tag-programming","tag-text-kit"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/37741","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=37741"}],"version-history":[{"count":1,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/37741\/revisions"}],"predecessor-version":[{"id":37742,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/37741\/revisions\/37742"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=37741"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=37741"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=37741"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}