不...当文本在UIButton(Swift)中太长时

时间:2016-08-23 02:46:00

标签: ios swift uibutton uikit

当文字太长时,uibutton会显示......,是否可以删除...?

1 个答案:

答案 0 :(得分:1)

您需要设置按钮的标签lineBreakMode,如下所示:

Swift 2.2

var button: UIButton!
button.titleLabel.lineBreakMode = .ByClipping

lineBreakMode解释NSLineBreakMode.ByClipping的可能值。

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div class="harga" id="harga"> 5000 </div> <select id="choose"> <option value="1">choose 1</option> <option value="2">choose 2</option> <option value="3">choose 3</option> </select> <script type="text/javascript"> var options = {"1":5000,"2":10000,"3":30000,} var amount = options["1"]; //default $('#choose').change(function() { selected_amount = options[$(this).val()]; $({ Counter: amount }).animate({ Counter: selected_amount }, { duration: 1000, //speed easing: 'swing', step: function () { $('#harga').text(Math.ceil(this.Counter)); }, complete: function(){ $('#harga').text(selected_amount); amount = selected_amount; } }); }); </script>听起来就像你想要的那样。