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

Sergio10

macrumors regular
Original poster
Oct 3, 2007
137
0
Hi,
I have 2 UIView (main menu and playfield). need to switch between theese controls. For example when I press "menu" button should see UIView main menu control.

Ho to implement it?
As I understood I should bind to UIWindow control?
Tahnks
 

BlackWolf

macrumors regular
Apr 9, 2009
244
0
there is no UIWindowController, is there?

Not quite sure what you mean though? If you want to "switch" between views you need to remove one from it's superview (removeFromSuperview-method) and then add the new view to the superview (probably the window if you are not using a tabbar) via the addSubview:-method, that's it.
 

Sergio10

macrumors regular
Original poster
Oct 3, 2007
137
0
I have next object in xib:
- UIWindow
- UIView1
- UIView2
- UIViewController

When run project I see UIWindow only. What exectly should I write for UIView switching? Should I delete UIWindow and use UIViewController and UIViews only?

Thanks
 

BlackWolf

macrumors regular
Apr 9, 2009
244
0
I have next object in xib:
- UIWindow
- UIView1
- UIView2
- UIViewController

When run project I see UIWindow only. What exectly should I write for UIView switching? Should I delete UIWindow and use UIViewController and UIViews only?

Thanks

first of all, you should read the basics on what parts make an iphone app, because you cannot delete the UIWindow, it's necessary to display your application. Seems to me like you need to read the basics of objective-C in general.
When your application loads you need to add a subview (a UIView) to UIWindow that you want to be displayed (actually, you don't NEED to do that, but you should). It's good practice to nest that subview in a UIViewController. You need a second UIView that you want to get displayed later, and you need some kind of mechanic that switches between the two views (a button?). when the user wants to switch to the other view (presses the button?) you simply remove the view that is currently displayed in your windows via the removeFromSuperview method. after that, you add the new view to your window via addSubview - that's it.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.