Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 使用initWithCoder从NIB中获取值:用于UIView的子类_Iphone_Objective C_Ios4 - Fatal编程技术网

Iphone 使用initWithCoder从NIB中获取值:用于UIView的子类

Iphone 使用initWithCoder从NIB中获取值:用于UIView的子类,iphone,objective-c,ios4,Iphone,Objective C,Ios4,我创建了UIView的子类,将UIView添加到nib,并将类名更改为my class 现在,我需要从笔尖查看视图的原始大小和位置。查看.xib文件可显示密钥NSFrame中所需的信息: <object class="IBUIView" id="79599448"> <reference key="NSNextResponder" ref="972514174"/> <int key="NSvFlags">292</int> <s

我创建了
UIView
的子类,将
UIView
添加到nib,并将类名更改为my class

现在,我需要从笔尖查看视图的原始大小和位置。查看.xib文件可显示密钥
NSFrame
中所需的信息:

<object class="IBUIView" id="79599448">
  <reference key="NSNextResponder" ref="972514174"/>
  <int key="NSvFlags">292</int>
  <string key="NSFrame">{{76, 62}, {224, 44}}</string>
  <reference key="NSSuperview" ref="972514174"/>
  <reference key="NSNextKeyView" ref="621711566"/>  
  <reference key="IBUIBackgroundColor" ref="1064304267"/>
  <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>

292
{{76, 62}, {224, 44}}
IBCocoaTouchFramework

如何在
initWithCoder:
中提取此键?

我希望我理解了您的问题,但一旦初始化了XIB,您就可以使用

NSRect originalFrame = myView.frame;

只要你把这段代码放在某个地方,它将在XIB初始化后立即运行,这应该就是你想要的。

不确定我是否理解你的问题,但如果你试图获得UIViews框架(它的位置和大小)。。。self.frame将起作用。不幸的是,我将UIPickerView子类化以创建一个水平的。为了正确旋转/变换,在UIPickerView更改其高度之前,我需要原始指定坐标