Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 04-12-2010, 04:31 AM   #1 (permalink)
Divine avenger
 
Johanovski's Avatar
 
Join Date: Nov 2009
Location: Vic, Catalunya (Spain)
Posts: 320
Johanovski is on a distinguished road
Default Autorotation in a UIView class?

Hi there!

I've read somewhere that the "shouldAutorotateToInterfaceOrientation" method must be placed in a UIViewController class and NOT in a UIView class, which is quite disgusting for me because I have ALL my logic and drawing methods in a UIView class... How can I add a UIViewController related to my UIView class to just handle rotation but don't have to move all my game logics and graphics into it?

Here's how my UIView subclass (named EAGLView) is called from the AppDelegate:

Code:
// myGameAppDelegate.h
#import <UIKit/UIKit.h>

// The EAGLView class inherits from a UIView
@class EAGLView;

@interface myGameAppDelegate : NSObject <UIApplicationDelegate> {
    UIWindow *window;
    EAGLView *glView;
}

@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet EAGLView *glView;

@end
Code:
// myGameAppDelegate.m
#import "myGameAppDelegate.h"
#import "EAGLView.h"

@implementation myGameAppDelegate

@synthesize window;
@synthesize glView;

- (void)applicationDidFinishLaunching:(UIApplication *)application {

        // Here is where the EAGLView class is initialized...
	glView.animationInterval = 1.0 / 60.0;
	[glView startAnimation];
}
It's easy to add a UIViewController "layer" to let me handle rotation but still maintain my app structure?

Thanks in advance!
Johanovski is offline   Reply With Quote
Old 12-29-2010, 09:35 PM   #2 (permalink)
Registered Member
 
Join Date: Aug 2009
Posts: 51
Dan the Man is on a distinguished road
Send a message via Yahoo to Dan the Man Send a message via Skype™ to Dan the Man
Default

I'm having the same problem with CG. anybody figure this out yet?
__________________
John 3:16 For God so loved the world that he gave his one and only Son, that whoever believes in him shall not perish but have eternal life.
Dan the Man is offline   Reply With Quote
Reply

Bookmarks

Tags
autorotation, ipad, uiview, uiviewcontroller

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 317
15 members and 302 guests
chemistry, Domele, Fstuff, givensur, heshiming, HowEver, iAppDeveloper, iphonedevshani, jbro, JoeRCruso, kapps11, newDev, SLIC, stanny, WheyLabs
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,648
Threads: 94,112
Posts: 402,874
Top Poster: BrianSlick (7,990)
Welcome to our newest member, brandon6031
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 07:26 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0