声明UI对象

时间:2015-01-14 20:25:53

标签: ios user-interface swift uilabel

好奇心问题: 我只是想知道以下是否存在真正的不同:

let champNameLabel: UILabel!
champNameLabel = UILabel(frame: CGRectMake( 0, 0,  cellSize(champsPerRow),  textHeight))
champNameLabel.center = CGPointMake(textCenterX, textCenterY)
champNameLabel.textAlignment = .Center
champNameLabel.textColor = UIColor.whiteColor()
champNameLabel.font = champNameLabel.font.fontWithSize(fontSize)
contentView.addSubview(champNameLabel)

let champNameLabel = UILabel()
champNameLabel.frame = CGRectMake( 0, 0,  cellSize(champsPerRow),  textHeight)
champNameLabel.center = CGPointMake(textCenterX, textCenterY)
champNameLabel.textAlignment = .Center
champNameLabel.textColor = UIColor.whiteColor()
champNameLabel.font = champNameLabel.font.fontWithSize(fontSize)
contentView.addSubview(champNameLabel)

我已经在教程中看到了网络的两种方式,并想知道一种方式是否更好。感谢您提前提供任何帮助。

0 个答案:

没有答案