我有一個類定義了UIVIew上的所有風格。 它們都是預定義的,但我不確定何時觸發此操作。如何以編程方式將風格應用於所有UIViews
當我嘗試這個創建擴展:
extension UIView
{
func willMoveToSuperview(newSuperview: UIView?)
{
self.stylize() // Another extension somewhere (not here my problem)
}
}
而且我得到這個錯誤:
Method 'willMoveToSuperview' with Objective-C selector conflicts with previews declaration with the same Objective-c selector
我試圖覆蓋它,但沒有任何工作。
當我所有的UIViews變得可見時,如何能夠應用相同的行爲的任何想法?
就是這樣!非常感謝你。 – Brduca
如果您有興趣,請查看[StyleSheet](https://github.com/werediver/StyleSheet)(具有可組合和可重用樣式的樣式微框架)。 – werediver