2009-12-11 92 views
1

对不起,我不是母语的人。UIWebView和滚动条指示器

我有滚动条指示器的问题。当我将一个simle web表单加载到一个UIWebView中时,滚动条指示器出现在屏幕的右侧。这是正确的,但是当我尝试编辑表单上的某个字段时,滚动条指示器会移动到WebView的中心,就像您在图片上看到的那样。请帮我解决这个问题。

alt text http://img22.imageshack.us/img22/7351/img0058w.png

更新:

我将在这里补充一些细节。

我创建了一个空的基于视图的项目。

在plist文件我添加一行:

Initial interface orientation = Landscape (right home button) 

之后,我打开界面Builer空视图,并添加一个UIWebView。

然后在ViewController中,我为它创建了一个Outlet。

在-vievDidLoaded功能我写了下面的代码:

NSURL *url = [NSURL URLWithString:@"http://my_url"]; 
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:10.0f]; 
[webView loadRequest:request]; 

[super viewDidLoad]; 

下面是加载页面的html代码:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html> 
<head> 
    <link href="/mobileproduct/css/webform/default.css" media="screen" rel="stylesheet" type="text/css" /></head> 
<body> 
    <form enctype="application/x-www-form-urlencoded" action="/mobileproduct/webform/buildwebform" method="post" class="webform"><dl class="zend_form"> 
<dt id="token-label">&nbsp;</dt> 
<dd id="token-element"> 
<input type="hidden" name="token" value="1700ec7d06a1a0521670d7df8ccd9571" id="token" /></dd> 
<dt id="authDataGroup-label">&nbsp;</dt><dd id="authDataGroup-element"><fieldset id="fieldset-authDataGroup"><legend>Personal info</legend> 
<dl> 
<dt id="name-label"><label for="name" class="required">Name:</label></dt> 
<dd id="name-element"> 
<input type="text" name="name" id="name" value="NameHh" maxlength="30" /></dd> 
<dt id="nick-label"><label for="nick" class="required">Nick:</label></dt> 
<dd id="nick-element"> 
<input type="text" name="nick" id="nick" value="nicker" maxlength="30" /></dd> 
<dt id="email-label"><label for="email" class="required">E-mail:</label></dt> 
<dd id="email-element"> 
<input type="text" name="email" id="email" value="[email protected]" maxlength="80" /></dd></dl></fieldset></dd> 
<dt id="dataGroup-label">&nbsp;</dt><dd id="dataGroup-element"><fieldset id="fieldset-dataGroup"><legend>Additional info</legend> 
<dl> 
<dt id="ref_custom_5-label"><label for="ref_custom_5" class="optional">Question 1</label></dt> 
<dd id="ref_custom_5-element"> 
<input type="text" name="ref_custom_5" id="ref_custom_5" value="Na" /></dd> 
<dt id="ref_custom_6-label"><label for="ref_custom_6" class="optional">Question 2</label></dt> 
<dd id="ref_custom_6-element"> 
<input type="text" name="ref_custom_6" id="ref_custom_6" value="qq" /></dd> 
<dt id="ref_select_2-label"><label for="ref_select_2" class="optional">Select Gender</label></dt> 
<dd id="ref_select_2-element"> 
<select name="ref_select_2" id="ref_select_2"> 
    <option value="" label="" selected="selected"></option> 
    <option value="1" label="male">male</option> 
    <option value="2" label="female" selected="selected">female</option> 
</select></dd></dl></fieldset></dd> 
<dt id="buttonsGroup-label">&nbsp;</dt><dd id="buttonsGroup-element"><fieldset id="fieldset-buttonsGroup"><dl> 

<input type="submit" name="submit" id="submit" value="Send" /> 

<input type="reset" name="reset" id="reset" value="Restore" /></dl></fieldset></dd></dl></form></body> 
</html> 

如果我不修改任何领域的形式,在滚动指示看起来很正常但是在输入之后(或者,如果需要,在显示/隐藏虚拟键盘之后)滚动指示器移动到错误的位置。

愚蠢的问题,但我真的不知道如何解决它。

+0

如何创建WebView?你明确地设置它的框架? – 2010-01-08 14:24:25

回答

0

我以前没见过。尝试通过syntax checker为初学者运行您的html。但是没有看到obj-c和html源代码,没有太多工作要做。