i want show image in webview but my problem is i want show the same image in ipad and iphone in different sizes. currently in my project i am getting image from database i am getting url.how should i vary from iphone and ipad .please help i used this code now开发者_开发问答 in the css i written sizes and attached tag in run time but it does not replacre the string why it is not replacing the string i dont know.if any one knows plaese help me in any context .
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%\"/>"];
}
You should use this construction:
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 30200
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
NSLog(@"iPad Idiom");
else
#else
NSLog(@"iPhone Idiom");
#endif
精彩评论