我正在尝试开发键盘,它应该使用与默认字体不同的字体。这是行:
var extend = function () {
var extended = {}, deep = false, i = 0, length = arguments.length;
// Check if a deep merge
if ( Object.prototype.toString.call( arguments[0] ) === '[object Boolean]' ) {
deep = arguments[0];
i++;
}
// Merge the object into the extended object
var merge = function (obj) {
for ( var prop in obj ) {
if ( Object.prototype.hasOwnProperty.call( obj, prop ) ) {
// If deep merge and property is an object, merge properties
if ( deep && Object.prototype.toString.call(obj[prop]) === '[object Object]' ) {
extended[prop] = extend( true, extended[prop], obj[prop] );
} else if (Object.prototype.toString.call(obj[prop]) === '[object Array]') {
if (extended[prop] && Object.prototype.toString.call(extended[prop]) === '[object Array]') {
extended[prop] = extended[prop].concat(obj[prop]);
} else if (!extended[prop]) {
extended[prop] = obj[prop];
}
} else {
extended[prop] = obj[prop];
}
}
}
};
// Loop through each object and conduct a merge
for ( ; i < length; i++ ) {
var obj = arguments[i];
merge(obj);
}
return extended;
};
var item1 = { name: 'Frank', age: 42, pets: ['cat', 'dog']};
var item2 = { name: 'Jane', pets: ['fish']};
var item3 = extend(true, item1, item2);
window.console.log(item3);
但它不起作用......我该如何解决? 感谢。
答案 0 :(得分:0)
按照以下步骤使用自定义字体
自定义字体:
myUILabel.text = "demoText"
myUILabel.font = UIFont(name: "myCustomFont.ttf", size: 25)