开发者

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;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜