我想使字符串符合标签的大小。下面的代码不会改变任何东西。我做错了什么?
nameLabel.font = UIFont.systemFont(ofSize: 30)
nameLabel.adjustsFontSizeToFitWidth = true
nameLabel.text = "fjggfjghggiuhgughuohgoihiohiohiughiugyiugyu8ftufuyguoy80houhuiy78rt6drtyreruti"
nameLabel.numberOfLines = 1
nameLabel.minimumScaleFactor = 0.5
答案 0 :(得分:0)
UIKit需要提示您想要多少行文本,或者不知道缩小了多少行。如果您希望整行文字适合一行中的标签,您还需要:$(document).ready(function() {
$('#search-results').removeClass('box');
$('.actionable-buttons').click(function(){
var action = $(this).attr('action');
$('#emptasks_action').val(action);
$('#frmEmpTaskManager').submit();
});
$('#btnSaveTask').click(function() {
$('#frmEmpTaskManager').submit();
});
$("#frmEmpTaskManager").validate({
rules: {
'emptasks[task_name]': {required: true},
'emptasks[description]' : {maxlength:1000},
'emptasks[due_date]' : {valid_date: function(){
return {format:datepickerDateFormat,
required:false,
displayFormat:displayDateFormat
};
}
}
},
messages: {
'emptasks[task_name]': {required: lang_taskNameRequired},
'emptasks[description]': {maxlength: lang_descriptionLength},
'emptasks[due_date]' : {valid_date: lang_invalidDate}
}
});
if(!(haveTasks)) {
$(".check").hide();
}
if($('#emptasks_id').val()==''){
$('#addEmployeeTask').hide();
}else{
$('#addEmployeeTask').show();
}
$('#btnAdd').click(function() {
$('#addEmployeeTask').show();
clearAddForm();
$('#search-results').find('div.top').hide();
});
$('#btnCancel').click(function() {
clearAddForm();
$('#addEmployeeTask').hide();
$('#search-results').find('div.top').show();
});
$('#btnDelete').attr('disabled', 'disabled');
$("#ohrmList_chkSelectAll").click(function() {
if ($(":checkbox").length == 1) {
$('#btnDelete').attr('disabled', 'disabled');
}
else {
if ($("#ohrmList_chkSelectAll").is(':checked')) {
$('#btnDelete').removeAttr('disabled');
} else {
$('#btnDelete').attr('disabled', 'disabled');
}
}
});
$(':checkbox[name*="chkSelectRow[]"]').click(function() {
if ($(':checkbox[name*="chkSelectRow[]"]').is(':checked')) {
$('#btnDelete').removeAttr('disabled');
} else {
$('#btnDelete').attr('disabled', 'disabled');
}
});
$('#dialogDeleteBtn').click(function() {
document.frmList_ohrmListComponent.submit();
});
$('#btnDelete').click(function() {
$('#deletePopUpMessenger').click();
});
$('#dialogDeleteBtn').click(function() {
document.frmList_ohrmListComponent.submit();
});
function clearAddForm() {
$('#emptasks_id').val('');
$('#emptasks_task_name').val('');
$('#emptasks_description').val('');
$('#emptasks_due_date').val('');
$('div#addEmployeeTask label.error').hide();
$('div#messagebar').hide();
}
});
。
工作场所示例:
nameLabel.numberOfLines = 1