ios - 如何从中间截断 View 标题
<p><p>我想从中间截断 View 标题。</p>
<p>代码:-</p>
<pre><code>self.title = ];
</code></pre>
<p>输出:- SearchResultWithCount(61...</p>
<p>但希望标题类似于:- SearchRe...thCount(612)。</p>
<p>请帮帮我。</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>我遇到了同样的问题,试试下面的代码:</p>
<pre><code>CGSize size=[ bounds ].size;
UILabel *titleLabel = [ initWithFrame:CGRectMake(size.width/2-120, 5, 200, 44)];
titleLabel.text = your_title_text;
titleLabel.lineBreakMode = NSLineBreakByTruncatingMiddle;
;
;
</code></pre></p>
<p style="font-size: 20px;">关于ios - 如何从中间截断 View 标题,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/27635831/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/27635831/
</a>
</p>
页:
[1]