HTML选框无法在iOS 5.1中运行 [英] HTML marquee not working in iOS 5.1

查看:63
本文介绍了HTML选框无法在iOS 5.1中运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请看下面的功能。

   - (void)loadHTMLinWebView 
{
objWebView = [[UIWebView alloc] initWithFrame:CGRectMake(0 ,0,self.frame.size.width,self.frame.size.height)];
objWebView.opaque = NO;
objWebView.userInteractionEnabled = NO;
objWebView.backgroundColor = [UIColor clearColor];
NSString * strTemp = @< html>< body style =margin-top:0px;保证金左:0像素; text-align:center>< marquee behavior =alternatestyle =font-family:Marker Felt; font-size:20px;颜色:#A52A2A; >试验< /选取框>< /字体>< /体>< / HTML> 中;
[objWebView loadHTMLString:strTemp baseURL:nil];
[self addSubview:objWebView];
}

以上是我为在UIWebView中加载HTML而编写的代码。



但是当我在 iOS 4.0 设备中运行此代码时,它运行良好,我在Webview中看到了marquee效果但是在 iOS 5.1 设备中运行此代码,它没有显示选框效果,它只显示文本。



不知道那里发生了什么。



请帮我解决这个问题。



谢谢检查你的代码我发现 behavior =alternate导致问题停止滚动。如果你把 behavior =scroll比滚动但不符合你的要求。



如果你看对于替代方案而言,可能对您有帮助。



以下是讨论此问题的几个讨论链接,建议不要使用选框。



link1
link2
link3



更新



Wowo!这很有意思。我再次检查,发现它确实有效但不适用于小字符串。它适用于有些大字符串。仍然没有关于这个问题的线索。


Please see below function.

-(void)loadHTMLinWebView
{   
    objWebView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
    objWebView.opaque = NO;
    objWebView.userInteractionEnabled = NO;
    objWebView.backgroundColor = [UIColor clearColor];
    NSString *strTemp = @"<html><body style="margin-top:0px; margin-left:0px; text-align:center"><marquee behavior="alternate" style="font-family:Marker Felt;font-size:20px; color:#A52A2A;">Test</marquee></font></body></html>";
    [objWebView loadHTMLString:strTemp baseURL:nil];
    [self addSubview:objWebView];
}

Above is the code that I had written for loading HTML in UIWebView.

But when I am running this code in iOS 4.0 device, It is working well and I saw marquee effect in Webview but running this code in iOS 5.1 device, It is not showing the marquee effect, It is just showing the text.

Don't know what is happening there.

Please help me to solve this problem.

Thanks in advance.

解决方案

Checking your code I found that behavior="alternate" is causing problem to stop scrolling. If you put behavior="scroll" than it will scroll but not as per your requirement.

If you look for alternates than there is other answer which may be helpful to you.

Here are few links to discussion which discuss this problem and recommends not to use marquee.

link1 link2 link3

Update

Wowo ! This is something interesting. I checked again and found that it does work but not for small strings. It works for somewhat large strings. Still no clue about the problem.

这篇关于HTML选框无法在iOS 5.1中运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆