如果在.defaultTextAttribute之前声明了一堆代码,为什么文本对齐属性不起作用?它没有抛出任何运行时错误,但它的属性从未改变或产生任何影响。
我有以下代码:
$objPHPExcel->getActiveSheet()->getDefaultRowDimension()->setRowHeight(-1);
当我改变
时,我开始工作了override func viewDidLoad() {
super.viewDidLoad()
// Setting the delegates
self.upperTextField.delegate = self
self.lowerTextField.delegate = self
// Default text of textFields
upperTextField.text = "Up"
lowerTextField.text = "Down"
// Default text Attributes
let textAttributes = [
NSStrokeColorAttributeName: UIColor.whiteColor(),
NSForegroundColorAttributeName: UIColor.blackColor(),
NSFontAttributeName: UIFont(name: "HelveticaNeue-CondensedBlack", size: 40)!,
NSStrokeWidthAttributeName: 0
]
upperTextField.defaultTextAttributes = textAttributes
lowerTextField.defaultTextAttributes = textAttributes
// Align text
upperTextField.textAlignment = .Center
lowerTextField.textAlignment = .Center
}
//默认文本属性
之后我正在使用Xcode 7.3和swift 2.
提前感谢任何建议!