LilMoke
LilMoke

Reputation: 3444

How to add TouchUpInside for button in UIView

I have the following:

- View
  Image View
  Image View
  - Second View
    Image View
    Image View
    MY BUTTON

When I go into Interface builder and try to add the TouchUpInside for "MY BUTTON" to the "Second View" it will not allow me to do so. I can only add it to the first view.

The "Second View" is a subclass of UIView, so I pick my class in Interface Builder but it wont let me create it.

Any help in understanding this will be appreciated.

I hope I explained it ok, sorry if it is a foolish question!!

Upvotes: 0

Views: 1035

Answers (2)

Bajaj
Bajaj

Reputation: 869

You want to choose a Button through xib file..rounded rect or custom. And declare in header file

IBOUTLet UIbutton * btn;

then action declare a method ...

-(IBAction)btnaction{
    //write your code
}

Then connectivity in the nib file.

Upvotes: 1

Inder Kumar Rathore
Inder Kumar Rathore

Reputation: 39978

I have done it and uploaded an image for you. Specify the second view class and then right click on the second view it will show the IBAction of in SecondView and then connect it.
here blue color view is second view with class SecondView.

enter image description here

Upvotes: 1

Related Questions