iphone instance / class method issue

Posted by user290031 on Stack Overflow See other posts from Stack Overflow or by user290031
Published on 2010-03-19T02:36:48Z Indexed on 2010/03/19 2:41 UTC
Read the original article Hit count: 274

Filed under:
|
|

Hey All,

Okay, so I have a viewController method that has some elements created with interface builder and some I coded myself.

I created a view in the IB...lets call it viewOne. I created a loop that creates buttons (through code) and places them on a separate view (viewTwo). This is done in a class method. However, I want the view I made to be opened everytime one of the buttons is clicked. So I did:

[button addTarget:self action:@selector(woogoo:) forControlEvents:UIControlEventTouchUpInside];

The woogoo class does the following:

+(void) woogoo:(id)sender { //back button [self.view addSubview:viewOne] }

However, the program crashes when a button is clicked. I did try making woogoo an instance method but it also crashes in this case too. All I want to do is show viewOne when a button is clicked. Any ideas what I can do?

© Stack Overflow or respective owner

Related posts about iphone

Related posts about uibutton