Self.view / super.view

What's the difference between

[self.view addSubview:view1];

and

[super.view addSubview:view1];

Thank!

Franhu

+3
source share
2 answers

If you have not redefined the method -view, there are no practical differences. However, out of semantic difference, saying super.view, is an explicit attempt to avoid calling a method with a name -viewdefined in the current class. If you do not want to express this value, you should stay away from the design super.whatever.

+5
source

Since submission is a property, there really isn’t much difference when it comes to it.

Personally, I find self.view to be more readable and the most commonly used idiom as far as I know.

0
source

Source: https://habr.com/ru/post/1789333/


All Articles