是否可以通过按钮事件更改方向但禁用自动旋转?

时间:2017-02-09 08:24:32

标签: ios objective-c

我使用下面的代码更改视图控制器的方向:

[[UIDevice currentDevice] setValue:[NSNumber numberWithInteger:UIDeviceOrientationLandscapeLeft] forKey:@"orientation"];

它可以强制定位到横向,但我无法通过禁用自动旋转来实现:

-(BOOL)shouldAutorotate {
    return NO;
}

是否可以通过按钮事件更改方向但禁用自动旋转?

1 个答案:

答案 0 :(得分:0)

声明一个布尔变量检查,然后根据您可以启用或禁用方向的值。

  UPDATE p 
SET    P.basevalue = ResTable.baseval, 
       P.treadvalue = ResTable.treadval, 
       P.lipvalue = ResTable.lipval, 
       P.centervalue = ResTable.centerval 
       from 
#productiondetails P 
       INNER JOIN (SELECT  A.basecode, 
                                   A.basescale, 
                                   ( A.basescale * B.baseper / 100 )     AS 
                                   BaseVal, 
                                   A.treadcode, 
                                   A.treadscale, 
                                   ( A.treadscale * B.treadper / 100 )   AS 
                                   TreadVal, 
                                   A.interfacecode, 
                                   A.lipcode, 
                                   A.lipscale, 
                                   ( A.lipscale * B.hsper / 100 )        AS 
                                   LipVal, 
                                   A.centercode, 
                                   A.centerscale, 
                                   ( A.centerscale * B.centerper / 100 ) AS 
                                   CenterVal, 
                                   A.stencilno 
                   FROM   #productiondetails A 
                          INNER JOIN #blendmaster B 
                                  ON  A.interfacecode = b.category 
                                       AND A.basecode = B.base  
                                       AND A.centercode = B.center  )
                   ---WHERE  B.status = 'yes' this condtiton is not present in yout 2 tables)
         ResTable 
               ON  P.stencilno = ResTable.stencilno