how do i make a button in a different view, send an action to something located in the other view?
I have a utility applicat开发者_如何学运维ion (the flippy template) and i would like to make a button on the flipside view, trigger an IBAction in the main view. how do i do this?
This can be done with delegates.
If your flipside view has a delegate (and for 99% it has), you can do something like this in FlipsideViewController.m
:
- (void)buttonClicked:(id)sender {
[[self delegate] flipsideButtonClicked];
}
In NormalViewController.m
insert:
- (void)flipsideButtonClicked {
// do your stuff
}
In NormalViewController.h
:
@interface ... {
...
}
// add this:
- (void)flipsideButtonClicked;
精彩评论