(iPhone,Obj-C)该“视图"在哪里?财产从何而来? [英] (iPhone,Obj-C) Where does this "view" property come from?

查看:33
本文介绍了(iPhone,Obj-C)该“视图"在哪里?财产从何而来?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了这段代码(在IBAction实例方法的.m实现文件中):

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指的是按钮,但是我想知道从哪里可以找到关于此"view"属性的信息,因为我查找了UIButton,UIView,NSObject,但找不到该"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.

(此外,由于我正在尝试学习所有正确的术语-我是一名iPhone初学者,因此对术语进行任何更正将不胜感激)

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

推荐答案

view属性是UIViewController之一.控制器通常在初始化时创建一个视图,并负责对其进行管理.UIViewController的任何子类都将继承此属性.有关更多详细信息,请参见此链接.另外,您可能想熟悉MVC(模型视图控制器),因为这可以更清楚地说明控制器为何具有视图属性.有关更多详细信息,请参见此链接

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.

这篇关于(iPhone,Obj-C)该“视图"在哪里?财产从何而来?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆