App won't rotate

Discussion in 'iOS Programming' started by spaceman816, Dec 21, 2009.

  1. spaceman816 macrumors member

    Joined:
    Jul 29, 2009
    #1
    For some reason, none of the views in the app I am writing will rotate. I return YES in the shouldAutorotate method, but when I open them in iphone simulator and try to rotate, the views stay in place.
    Any idea why this may be happening?

    Thanks.
     
  2. spaceman816 thread starter macrumors member

    Joined:
    Jul 29, 2009
    #2
    Please?

    I'm having a lot of trouble with this. All my other apps rotate quite easily, but I can't seem to get any of the views to rotate here.
     
  3. csnplt macrumors 6502

    csnplt

    Joined:
    Aug 29, 2008
    Location:
    Chicago Area
    #3
    Are these views contained within a navigation controller or tab bar controller?
     
  4. spaceman816 thread starter macrumors member

    Joined:
    Jul 29, 2009
    #4
    It's a utility application, and on the flipside the views are contained within a navigation controller.
    But none of these views (even the front) will rotate.
     
  5. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #5
    I just created a project using the Utility Application template, uncommented and changed the shouldAutorotateToInterfaceOrientation: methods in both MainViewController and FlipsideViewController to return YES and it rotates fine. So, let's try to figure out how your app is different from the template in that even the front (main) view doesn't autorotate. Did you start with the Utility Application template?
     
  6. spaceman816 thread starter macrumors member

    Joined:
    Jul 29, 2009
    #6
    Yes. I started with a Utility template- the front side is just a table view, and the backside is a navigation controller in which the user downloads or edits the table view.

    This is the header file for my front side:
    Code:
    #import <UIKit/UIKit.h>
    #import "/usr/include/sqlite3.h"
    
    @class RamazSchedulerAppDelegate;
    
    @interface MainViewController : UIViewController
    	<UITableViewDelegate, UITableViewDataSource> {
    	
    	NSArray *data;
    	NSDictionary *timesDict;
    	NSDictionary *selectedTimesDict;
    		
    	NSArray *daysData;
    	NSDictionary *daysDict;
    	NSDictionary *selectedDaysDict;
    	NSDictionary *selectedPeriodDict;
    	NSString *selectedDay;
    	
    	UISegmentedControl *times;
    	UISegmentedControl *days;
    	IBOutlet UITableView *table;
    	IBOutlet UIButton *infoButton;
    	NSInteger currentPeriod;
    	
    	sqlite3 *database;
    	NSTimer *timer;
    				
    }
    
    @property (nonatomic, retain) NSArray *data;
    @property (nonatomic, retain) NSDictionary *timesDict;
    @property (nonatomic, retain) NSDictionary *selectedTimesDict;
    @property (nonatomic, retain) NSArray *daysData;
    @property (nonatomic, retain) NSDictionary *daysDict;
    @property (nonatomic, retain) NSDictionary *selectedDaysDict;
    @property (nonatomic, retain) NSDictionary *selectedPeriodDict;
    @property (nonatomic, retain) NSString *selectedDay;
    @property (nonatomic, retain) UISegmentedControl *times;
    @property (nonatomic, retain) UISegmentedControl *days;
    @property (nonatomic, retain) UITableView *table;
    @property (nonatomic, retain) UIButton *infoButton;
    @property (nonatomic) NSInteger currentPeriod;
    @property (nonatomic, retain) NSTimer *timer;
    
    -(IBAction)backgroundClick:(id)sender;
    -(IBAction)switchWindow:(id)sender;
    -(void)highlightCell:(NSTimer *)timer;
    
    
    
    @end
    
    And this is the shouldAutorotate method from the .m:
    Code:
    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    	// Return YES for supported orientations
    	return YES;
    }
    Note: none of the views in the app (even ones that are just a single picture) will rotate when i change their autorotate methods to return YES
     
  7. Matthew Yohe macrumors 68020

    Joined:
    Oct 12, 2006
    #7
    It doesn't sound like you changed the rotate override in MainViewController.
     
  8. spaceman816 thread starter macrumors member

    Joined:
    Jul 29, 2009
    #8
    The quoted shouldAutorotate method is from MainViewController.m
     
  9. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #9
    And you're sure this shouldAutorotateToInterfaceOrientation: is being called?
     
  10. spaceman816 thread starter macrumors member

    Joined:
    Jul 29, 2009
    #10
    Yes. it's called as soon as the app is opened.
     

Share This Page