Why doesn't my Cordova/PhoneGap iOS app rotate when the device rotates?

前端 未结 4 1512
囚心锁ツ
囚心锁ツ 2020-11-30 09:36

I am trying to make a landscape only app, but I am not able to produce any rotation at all.

There used to be a autorotate setting in PhoneGap.plis

4条回答
  •  天命终不由人
    2020-11-30 09:38

    In Classes/MainViewController.m return true:

    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
    {
        // Return YES for supported orientations
        //return (interfaceOrientation == UIInterfaceOrientationPortrait);
        return true;
    }
    

    For iOS >= 6

    - (BOOL)shouldAutorotate {
        return YES;
    }
    -(NSUInteger)supportedInterfaceOrientations
    {
        return [[self.viewControllers lastObject] supportedInterfaceOrientations];
    }
    

    Source

提交回复
热议问题