zoukankan      html  css  js  c++  java
  • 用通知解决由iphone 4到iphone 5由于屏幕变大带来的问题

    由iphone 4到iphone 5屏幕增大,会导致之前的应用出现两条黑边。我的应用是给黑边加两张图片进行遮盖。操作方法:

    1.在appdelegate中判断是否是iphone5 设备。如果是,加两个window,用以存放图片。

    if(iphone 5)

    {

     nsstring *path = [[nsbundle mainbundle]pathforresource:@"zuobian" oftype:@"png"];

    uiiamge *image = [uiimage imagewithcontentsoffile:path];//获取图片

    uiimageview *view = [[uiimageview alloc]initwithimage:image];

    uiwindow *window1 = [[uiwindow alloc]initwithframe:(cgrect){{0,0},{320,44}}];

    [window1 addsubview:view];

    window1.windowlevel = 3;

    [window1 makekeyandvisible];

    同理加上window2(rect为{0,524});

    }

    2.在应用的入口加上通知:

    if(iphone 5)

    {

     [[nsnotificationcenter defaultcenter]addobserver:self selector(changeNum) name:uideviceOrientationIsLandscape(90) object:nil];

    }

    -(void)changeNum

    {

     UIInterfaceOrientation orientation = self.interfaceOrientation;

    if(orientation == UIInterfaceOrientationLandscapeLeft && [PublicVarible singleInstance].Is_Iphone5 == NO)   //publicVarible为一个判断iphone5的单例{

          uiwindow *left =  [[uiapplication shareapplication].keyWindow];

          left.frame = cgrectmake(0,-44,320,568);

    }

    else if(*********right && *****)

    {

         **********

         right.frame = cgrectmake(0,44,320,568);

    }

    }

  • 相关阅读:
    hdu 1017 A Mathematical Curiosity 解题报告
    hdu 2069 Coin Change 解题报告
    hut 1574 组合问题 解题报告
    hdu 2111 Saving HDU 解题报
    hut 1054 Jesse's Code 解题报告
    hdu1131 Count the Trees解题报告
    hdu 2159 FATE 解题报告
    hdu 1879 继续畅通工程 解题报告
    oracle的系统和对象权限
    oracle 自定义函数 返回一个表类型
  • 原文地址:https://www.cnblogs.com/xcy617/p/2875087.html
Copyright © 2011-2022 走看看