开发者

how do i make a button in a different view, send an action to something located in the other view?

开发者 https://www.devze.com 2023-03-29 15:20 出处:网络
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

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

精彩评论

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