2013-04-11 224 views
0

我是新來的ios,我想在分屏視圖中顯示webview。 顯示webview內容,但我無法在webview內容中滾動。它仍然是固定的。 以下是我的代碼:ios:webview滾動不起作用

- (void)viewDidLoad 
{ 
    [super viewDidLoad]; 
     // Do any additional setup after loading the view from its nib. 
    webViewProcDescription.userInteractionEnabled = YES; 
    webViewProcDescription.scrollView.scrollEnabled = YES; 

    [self configureView]; 
} 



- (void)configureView 
{ 


    NSString *htmlFile = [[NSBundle mainBundle] pathForResource:@"Stage1" ofType:@"html"]; 

    NSString * htmlString = [NSString stringWithContentsOfFile:htmlFile encoding:NSUTF8StringEncoding error:nil]; 
    [webViewProcDescription loadHTMLString:htmlString baseURL:nil]; 
} 

我還試圖用一個UIScrollView這依然沒有結果。我甚至嘗試設置webview的屬性,如userInteractionEnabled = YES,webViewProcDescription.scrollView.scrollEnabled = YES,webViewProcDescription.scalesPageToFit等依然相同。 我哪裏錯了?我如何解決這個問題。

編輯:stage1.html代碼

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> 
<html> 
<head> 
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 
    <meta http-equiv="Content-Style-Type" content="text/css"> 
    <title></title> 
    <meta name="Generator" content="Cocoa HTML Writer"> 
    <meta name="CocoaVersion" content="1187.34"> 
    <style type="text/css"> 
    </style> 
<javascript type="text/javascript"> 
window.onload = function() { 
    window.location.href = "ready://" + document.body.offsetHeight; 
} 
</script> 
</head> 
<body> 
    <h2>Stage I Reconstruction, Norwood Operation </h2> 

    <p>Your child has complex single ventricle anatomy. In a normal heart there are four chambers, two paired atria and two paired ventricles. The wall between the atria is called the atrial septum, and likewise the wall between the ventricles is called the ventricular septum. In a normal heart, deoxygenated 「blue」 blood returns from the body to the right atrium and then the right ventricle pumps the blood to the lungs where it is oxygenated. After blood is oxygenated in the lungs it returns to the left atrium and then the left ventricle pumps it out through the aorta to supply oxygen to the head and body (Figure 1). This pattern of blood flow is called an <i> in series circulation. </i> </p> 

    <p>Children with complex cardiac anatomy may progress down the single ventricle pathway because either the left or right ventricle is severely under-developed; there is severe obstruction to aortic flow or multiple anomalies that makes it impossible to separate the right and left heart. Lesions resulting in single ventricle anatomy include tricuspid atresia, hypoplastic left heart syndrome, double inlet left ventricle, unbalanced atrioventricular canal defects, complex transposition of the great arteries and heterotaxy syndrome.</p> 

    <p>In the single ventricle heart, all of the deoxygenated 「blue」 blood from the body and all of the oxygenated blood from the lungs returns to a common atrial chamber where it mixes. The mixed blood then empties into the ventricular chamber and is ejected out of the aorta to the head and body. Pulmonary blood flow is established using a shunt that will be described below. This type of circulation is called parallel circulation.</p> 

    <p>The operative objectives in a stage I reconstruction for a patient with a single ventricle include establishing unobstructed systemic blood flow to the brain and body, unobstructed blood return from the lungs, non-distorted and normal sized pulmonary arteries, limited pulmonary blood flow at low pressure, balanced pulmonary and systemic flows and minimal atrioventricular valve regurgitation.</p> 

    <p>Your child will be taken to the OR by the anesthesiologist where they will be put to sleep and then have IV’s and arterial access placed to continuously monitor blood pressure. The sternum (breastbone) is divided to expose the heart. We fully dissect the aorta, pulmonary artery and ductus arteriosus before preparing for cardiopulmonary bypass. In order for us to operate on your child’s heart we have to use the cardiopulmonary bypass (CPB) machine. When we get ready to put someone on 「bypass」 we first have to give a large dose of heparin, which is a blood thinner used to prevent blood clots. We place special cannulae into the aorta or pulmonary artery and into the right atrium. The CPB tubing is relatively long and in order to remove all of the air from the line we often have to use donated blood to 「prime」 the circuit. Once we go on 「bypass」 all of the venous blood is returned to the bypass machine where it is oxygenated and then pumped into the aortic cannulae. The CPB machine allows us to safely stop the heart while maintaining good blood pressure and oxygen delivery to the brain and body.</p> 

    <p>As mentioned above, there are 2 main types of shunts used to supply blood to the lungs; the modified Blalock-Taussig (BT) shunt and the right ventricle-to-pulmonary artery (Sano) shunt. A BT shunt is a short piece of gortex tubing, usually 3.5-4mm in diameter that is sutured to the base of the subclavian artery and implanted into the top of the right pulmonary artery. A Sano shunt is larger piece of gortex tubing, usually 5-6mm, that is sutured directly to the right ventricle and implanted into the confluence of the right and left pulmonary arteries. If your child is getting a BT shunt then we next place a special clamp across the right subclavian artery and suture a small, gortex tube to the base of the subclavian artery. A small clip is placed across the shunt and the other end is completed later in the operation.</p> 

</body> 
</html> 
+0

你能不能請粘貼你的stage1.html – 2013-04-11 07:25:33

+0

@Manohar我粘貼了頁面 – z22 2013-04-11 07:30:39

+0

你有通過webview啓用的手勢識別器嗎? – Cyrille 2013-04-11 07:39:44

回答

1

發現的bug。我添加了我的UIWebView的視圖意外地是not set to user interaction enabled = yes。 一旦我將主視圖的User Interaction Enabled屬性設置爲YES,它就開始工作。

+0

對於iOS 8我需要: '_myWebView.scrollView.scrollEnabled = YES;' 而愚蠢的東西仍然不可見。這是自從單鍵鼠標以來,蘋果一直耿耿於懷的最愚蠢的事情。 – 2016-04-05 17:46:26