I have a program with multiple views, one of them has labels (LabelView for this question), the other has text fields(TextView for this question). I would like to take the info from the text fields, and put it on the label, I think the easiest way to do this by calling a method LabelView from TextView.
I have tried a couple things:
I tried putting a method in LabelView that changed the label's values with parameters. Then calling the method in TextView and passing the data through the parameters.
I tried making a delegate, using this question. Unfortunately the last step (add
settingView.viewControllerDelegate=self
to theviewDidLoad
method) failed.settingView
was an undeclared identifier.
Does anyone know what I should do?
EDIT: Here is some I have done, using Xman's Parent/Child view idea. This is in TextView.m:
NSInteger curScore = [self.ToP1Score.text integerValue];
NSInteger curPhase = [self.ToP1Phase.text integerValue];
self.ToP1Score.text = [NSString stringWithFormat:@"%d", (curScore += [self.player1Txt.text integerValue])];
if ([self.player1Txt.text integerValue] < 50) {
self.ToP1Phase.text = [NSString stringWithFormat:@"%d", (curPhase += 1)];
}