Iphone 从委托数组获取所有对象属性

Iphone 从委托数组获取所有对象属性,iphone,arrays,delegates,tableview,Iphone,Arrays,Delegates,Tableview,我正在成功地从委托中检索数组,但是我正在努力获取所有对象属性,因此在我的AppDelegate中: arrayOne = [[NSMutableArray alloc] init]; NSMutableArray *tempArray1 = [self myArray]; // Add names to arrayOne for (MyInfo *info in tempArray1) { [arrayOne addObject:info.name];

我正在成功地从委托中检索数组,但是我正在努力获取所有对象属性,因此在我的
AppDelegate
中:

    arrayOne = [[NSMutableArray alloc] init];
    NSMutableArray *tempArray1 = [self myArray];
// Add names to arrayOne
    for (MyInfo *info in tempArray1) {
        [arrayOne addObject:info.name];
    }
然后,我在我的
main视图中检索它:

    cell.textLabel.text = [delegate.currentlyUsedArray objectAtIndex:row];
这很好,但是
myArray
包含其他属性,例如:
info.age
info.height
-如何将这些属性传递到另一个
textlab
?我必须采用与上述相同的方法还是有更有效的方法?

混合泳,
您可以将appDelegate
myArray
的方法公开,并从您需要的位置获取信息值,在本例中是在
cellForRowAtIndexPath:
方法中。

为什么不能将
info
添加到数组中呢

for (MyInfo *info in tempArray1) {
    [arrayOne addObject:info];
}
稍后在哪里设置它

MyInfo *info = (MyInfo*)[delegate.currentlyUsedArray objectAtIndex:row];
cell.textLabel.text = info.name;

// Other fields should also accessible directly such as info.age and info.height.

按照Zapko的回答,MainView中的代码如下所示,以访问代理对象的myArray属性中MyInfo对象的各种属性:

cell.textLabel.text  = [(MyInfo *)[delegate.myArray objectAtIndex:row] name];
cell.ageLabel.text   = [(MyInfo *)[delegate.myArray objectAtIndex:row] age];
cell.heigtLabel.text = [(MyInfo *)[delegate.myArray objectAtIndex:row] height];

嗨,扎普科,谢谢你的回复,听起来不错。。。因此,我在
AppDelegate
中公开了
myArray
,那么我还需要在
MainView中公开它吗?然后在我的
cellforrowatinexpath
中,我应该能够获得
myArray.info
myArray.age
等。。。?谢谢你的时间!还有,在
cellforrowatinexpath
中会是什么样子?它是否类似于:
cell.textlab.text=[delegate.myArray.info.name objectAtIndex:row]?再次感谢!是的,我想它看起来像:
cell.textlab.text=((MyInfo*)[delegate.myArray objectAtIndex.row])。name
太棒了!非常感谢!很好。嗨,谢谢你的回答!我选择了Deepak的解决方案,但你的回答也很有帮助,就像Zapko的。。。如果可以,我会投票给你们所有人!!!