bluetooth99 2013-06-13 06:44 采纳率: 0%
浏览 2017
已采纳

在WeeApp中的横屏模式

需要横屏模式下,在widget中心做一个标签。

[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
if (([[UIDevice currentDevice] orientation] == UIDeviceOrientationLandscapeLeft) ||
    ([[UIDevice currentDevice] orientation] == UIDeviceOrientationLandscapeRight))
{
     d = 516; //my var to change the Position (The Value is just a test)
}

不知道为什么没实现。

  • 写回答

1条回答

  • xinyoulingxi1_tong 2013-06-13 08:50
    关注

    AppController定义这个方法:

    - (void)willAnimateRotationToInterfaceOrientation:(int)arg1
    

    然后检测方向:

    if (UIInterfaceOrientationIsLandscape(arg1)) {
        // you're in landscape mode
        float screenWidth = [UIScreen mainScreen].bounds.size.height;
    }
    else {
        // you're in portrait mode
        float screenWidth = [UIScreen mainScreen].bounds.size.width;
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料
  • ¥15 使用R语言marginaleffects包进行边际效应图绘制