我想從一個viewController發送數組到另一個使用協議和委託。我在viewcontroller B上聲明瞭委託,並在viewcontroller A中使用以下代碼將消息從A發送到B.協議的方法是didReceiveMessage。不幸的是,這個消息永遠不會到來。使用委託的ViewControllers之間的消息
附件是從的viewController甲
- (IBAction) graphPressed:(UIButton *)sender {
GraphingViewController *gvc=[[GraphingViewController alloc] initWithNibName:nil bundle:nil];
[self presentModalViewController:gvc animated:YES];
[gvc release];
[delegate didReceiveMessage:brain.internalExpression];
}
的代碼和從viewcontrollerB
- (IBAction) ViewdidLoad {
CalculatorViewController *cvc =[[CalculatorViewController alloc] init];
cvc.delegate=self;
[cvc release];
}
- (void) didReceiveMessage:(NSMutableArray *)expression {
NSLog(@"message received from CalculatorAppDelegate");
}
代碼任何建議,將不勝感激。
感謝您的回覆。關於如何將指針保留在周圍的任何建議。如果我從孩子分類視圖A,我將失去我需要的信息。 – jack 2011-01-15 20:31:03