来自另一个viewcontrol的模态视图信息

时间:2011-05-26 22:32:14

标签: ios properties uiviewcontroller

我在这里疯了。

我正在尝试从一个viewcontrol发送标签数据,以便在另一个视图控件中显示。

下面从按钮发送信息,我正在寻找的是如何发送标签信息,

打开MODAL

-(IBAction) showModal:(id)sender {
    outputLabel.text=@"Nothing Chosen";
    [[(ContentViewController *)self.parentViewController outputLabel] 
     setText:[sender currentTitle]];

switch (transitionStyle.selectedSegmentIndex) {
        modalContent.modalTransitionStyle=
        UIModalTransitionStyleCrossDissolve;
        break;
        }
[self presentModalViewController:modalContent animated:YES];
}

收到了模特回复

-(IBAction) hideModal:(id)sender {
      outputLabel2.text=@"12" ;
    [[(Corina3ViewController *)self.parentViewController outputLabel] 
     setText:[sender currentTitle]];
    [self dismissModalViewControllerAnimated:YES];   

}

我想将标签信息发送到模型,,,标签是“clearbLabel”

杰森

1 个答案:

答案 0 :(得分:0)

在modalView中创建一个标签对象,并将其设置为- showModal:方法

modalView:

// @interface
UILabel *clearLabel
// don't forget to @synthesize
-(IBAction) showModal:(id)sender {
    // your code;
    [modalView setClearLabel: clearLabel];
}

你甚至可以在以下之后把它弄掉:

-(IBAction) hideModal:(id)sender {
    // your code;
    [modalView setClearLabel: nil];
}