开发者

(iPhone,Obj-C) Where does this "view" property come from?

开发者 https://www.devze.com 2022-12-14 20:59 出处:网络
I ran across this segment of code (in .m implementation file in an IBAction instance method): UIActionSheet *actionSheet = [[UIActionSheet alloc] ...];

I ran across this segment of code (in .m implementation file in an IBAction instance method):

UIActionSheet *actionSheet = [[UIActionSheet alloc] ...];
...
[actionSheet showInView:self.view];

self refers to the button but I wanted to know where I could find out about this "view" property since I looked up UIButton, UIView, NSObject, but could not find out where this "开发者_开发知识库view" property came from.

(also, any corrections on terminology would be appreciated since I am trying to learn all the correct terms - I'm a beginner iPhone programmer)


The view property is one of a UIViewController. The controller usually creates a view in its initialization, and is responsible for managing it. Any subclass of UIViewController will inherit this property. See this link for more details. Also, you may want to familiarize yourself with MVC(model view controller), as this might make it more clear why the controller has a view property. See this link for more details.

0

精彩评论

暂无评论...
验证码 换一张
取 消