user1516779
user1516779

Reputation: 35

How to call different button click event method in if condition?

I am beginner of iPhone. I have create five button. button click event perform go to other class in that how to call button click event method..?

it is in ViewController class

(IBAction)onclickbutton1
{
}
(IBAction)onclickbutton2
{
}

and this onclickbutton1 and onclickbutton2 method how to call in other class in if condition so, that condition of onclickbutton1 is true perform onclickbutton event

Upvotes: 0

Views: 815

Answers (1)

trojanfoe
trojanfoe

Reputation: 122458

Just add a test within the event handling methods:

- (IBAction)onclickbutton1
{
    if (conditionIsTrue)
        [OtherClass doThing1];
    else
        [OtherClass doThing2];
}

- (IBAction)onclickbutton2
{
    if (conditionIsTrue)
        [OtherClass doThing1];
    else
        [OtherClass doThing2];
}

Upvotes: 1

Related Questions