【问题标题】:How To Show Same Images In Different For Sizes In Iphone And Ipad如何在 Iphone 和 Ipad 中显示不同尺寸的相同图像
【发布时间】:2011-02-18 06:16:19
【问题描述】:

我想在 webview 中显示图像,但我的问题是我想在不同尺寸的 ipad 和 iphone 中显示相同的图像。 目前在我的项目中,我正在从数据库中获取图像,我正在获取 url。我应该如何与 iphone 和 ipad 有所不同。请帮助 我现在在 css 中使用了这段代码,我在运行时编写了尺寸和附加标签,但它没有替换字符串,为什么它没有替换我不知道的字符串。如果有人知道,请在任何情况下帮助我。

if ([deviceType isEqualToString:@"iPad Simulator"]) 
    {
        //contentString =[contentString stringByReplacingOccurrencesOfString:@"/>" withString:@"width:\"30%\" height:\"30%\"/>"];
        contentString =[contentString stringByReplacingOccurrencesOfString:@"/>" withString:@"class=\"img_ipad\"/>"];


    }
    else
    {
        contentString =[contentString stringByReplacingOccurrencesOfString:@"/>" withString:@"width:\"70%\" height:\"70%\"/>"];
    }

【问题讨论】:

    标签: iphone ipad uiwebview ios-simulator


    【解决方案1】:

    你应该使用这个结构:

    #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 30200
        if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
            NSLog(@"iPad Idiom"); 
        else
    #else
            NSLog(@"iPhone Idiom");
    #endif
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-08-15
      • 1970-01-01
      • 2012-03-15
      • 2015-02-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-04-09
      相关资源
      最近更新 更多