如何从选项卡控制器中访问视图?

时间:2012-05-15 05:53:49

标签: ios ios5 delegates uinavigationcontroller uitabbarcontroller

if([[segue identifier] isEqualToString:@"dischargeSegue"])
{
    UITabBarController *dc = [segue destinationViewController];

    dischargeView *discharge = (dischargeView *)[[dc.viewControllers objectAtIndex:0] objectAtIndex:0];
    discharge.delegate = self;
}

我正在尝试为标签视图控制器的初始视图设置委托。这是我尝试的,但得到以下错误:无法识别的选择器发送到实例

enter image description here

1 个答案:

答案 0 :(得分:0)

使用 -

dischargeView *discharge =  (dischargeView *)[[[dc.viewControllers objectAtIndex:0] viewControllers] objectAtIndex:0];