Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

neil.b

macrumors member
Nov 20, 2008
65
0
I don't know much about your level of experience but, without meaning to offend, I think you need to go back and re-read the basics. I know because I went through the learning pain myself and I see you making the same mistakes I did. :)

You seem to have got yourself tied up in knots and it's difficult to help without seeing all the files and code.

Create a new temp project from scratch and build a simple RootViewController<->ViewController<->View interface.

Actually, create a project with the "Utility Application" template and study it - it uses a RootViewController with two sub ViewControllers to manage views.
 

mcannell

macrumors member
Original poster
Dec 20, 2008
36
0
I'm going to have to.

What I just can't understand is why I can add buttons and they work fine, do what I need, everything....

UNLESS, they are in the ViewController subclass...

That just doesn't make sense to me.


If I do the buttons in the UIView subclass.... all my buttons work fine
If I do the buttons in the UIViewController subclass.... crash & burn

What am I missing?
 

neil.b

macrumors member
Nov 20, 2008
65
0
I'm going to have to.

What I just can't understand is why I can add buttons and they work fine, do what I need, everything....

UNLESS, they are in the ViewController subclass...

That just doesn't make sense to me.


If I do the buttons in the UIView subclass.... all my buttons work fine
If I do the buttons in the UIViewController subclass.... crash & burn

What am I missing?

If it's any consolation I went through a similarly frustrating experience. In the end I backed away from the iPhone altogether and worked my way through the basics of Cocoa and Interface Builder. Then once I thought I understood how to use IB a bit better I went back to iPhone.

Anyway :)

So in the xxxxViewControler.xib you;

- added the button(s) to the View
- added the actions(s) to the File's Owner
- connected the buttons(s) to the action(s) in the File's Owner
- then selected "File's Owner" and from the menu File->Write Class Files?
 

mcannell

macrumors member
Original poster
Dec 20, 2008
36
0
I started the entire project over and all my buttons are working, it builds and runs.

When I click the button that is to call the function in the RootViewController class, the button prints in the NSLog that it is being pressed but it doesn't call the method in the other file.

Any ideas?

EDIT:
neil...

can you send me an entire project where you have this working?

I get no errors but it doesn't do anything..
 

neil.b

macrumors member
Nov 20, 2008
65
0
I started the entire project over and all my buttons are working, it builds and runs.

When I click the button that is to call the function in the RootViewController class, the button prints in the NSLog that it is being pressed but it doesn't call the method in the other file.

Any ideas?

EDIT:
neil...

can you send me an entire project where you have this working?

I get no errors but it doesn't do anything..

As it's the season of good will, I'll send you a project with it working. :)

Let me just be clear about what you want to see;

a project with a RootViewController and one other ViewController where you press a button in the second ViewController and it calls a method in the RootViewController?
 

neil.b

macrumors member
Nov 20, 2008
65
0
I knocked this up for you.

It has a RootViewController (with an orange view) that loads a second UIViewController "SplashScreenViewController". The view of the SplashScreenViewController (light blue) has a button that when pressed, calls a method in the RootViewController which removes the SplashScreenViewController view from the screen.

Have fun :)
 

Attachments

  • mcannell.zip
    23.5 KB · Views: 112
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.