我最近迁移到VIPER,在使用这种类型的体系结构时遇到了这样的问题:
例如,我在设计长(2000pt高)UI时,使用了超过50个界面元素,例如标签,按钮,视图,集合等,我需要在其中添加圆角和阴影。
我应该在哪里配置外观?是在View中显示,还是在Presenter中显示?
到目前为止,我已经扩展了UIView,它是创建阴影的方法。
现在,我在“查看”模块中拥有的是:
override func viewDidLayoutSubviews() {
doctorsNearCollection.backgroundColor = UIColor(white: 1, alpha: 0)
newsMayBeInterestedCollection.backgroundColor = UIColor(white: 1, alpha: 0)
recentSavedNewsCollection.backgroundColor = UIColor(white: 1, alpha: 0)
setupCharts()
scheduleMetting.dropShadow()
scheduleMetting.layer.cornerRadius = 5
monthlyPerformaceBackground.dropShadow()
monthlyPerformaceBackground.layer.cornerRadius = 5
firstMeeting.dropShadow()
firstMeeting.layer.cornerRadius = 5
firstMeetingNumber.layer.cornerRadius = self.firstMeetingNumber.frame.size.width / 2
secondMeeting.dropShadow()
secondMeeting.layer.cornerRadius = 5
secondMeetingNumber.layer.cornerRadius = self.secondMeetingNumber.frame.size.width / 2
thirdMeeting.dropShadow()
thirdMeeting.layer.cornerRadius = 5
thirdMeetingNumber.layer.cornerRadius = self.thirdMeetingNumber.frame.size.width / 2
seeAllMeetings.dropShadow()
seeAllMeetings.layer.cornerRadius = 5
searchForDoctors.dropShadow()
searchForDoctors.layer.cornerRadius = 5
seeAllSavedNews.dropShadow()
seeAllSavedNews.layer.cornerRadius = 5
}
这是一个好习惯吗? 我对设置视图外观感兴趣,因为对其他方法而言,这似乎或多或少对我来说很清楚。 预先感谢。
答案 0 :(得分:1)