2010-09-21 79 views
0

我創建了一個示例,其中我將一個單詞(.docx)導入到uiwebview中並進行了顯示。我得到了輸出,但我不想顯示水平滾動條和垂直滾動,也不能正常顯示我可以看到當我垂直滾動時,webview背後的黑色空間。 這裏是我的代碼:如何禁用uiwebview的水平滾動?

#import <UIKit/UIKit.h> 

@interface userguideLinesNewViewController : UIViewController { 
    IBOutlet UIWebView *webView; 
} 
@property (nonatomic,retain) UIWebView *webView; 
-(void)loadDocument:(NSString*)documentName inView:(UIWebView*)webViews; 
@end 
#import "userguideLinesNewViewController.h" 

@implementation userguideLinesNewViewController 
@synthesize webView; 
-(void)loadDocument:(NSString*)documentName inView:(UIWebView*)webViews 
{ 

NSString *path = [[NSBundle mainBundle] pathForResource:@"BTBP CLARITY SKIN ADVISORuser.docx" ofType:nil]; 
    NSURL *url = [NSURL fileURLWithPath:path]; 
NSURLRequest *request = [NSURLRequest requestWithURL:url]; 
[webViews loadRequest:request]; 
} 
- (void)viewDidLoad { 
    [super viewDidLoad]; 
[self loadDocument:@"BTBP CLARITY SKIN ADVISORuser.docx" inView:self.webView]; 
} 
+0

請設置

來包裝你的代碼^^ –
                        
                            
    Vinzius
                                2010-09-21 08:57:02
                            
                        
                    

回答

2

你可以檢查這個人的話題:Stop UIWebView from "bouncing" vertically? :-)

沒有像UIScrollView的方法。但有一種方式來實現你的目標;-)

這是我的方式。

- (void)disableBounce { 

    for (id subview in self.subviews) 
     if ([[subview class] isSubclassOfClass: [UIScrollView class]]) 
      ((UIScrollView *)subview).bounces = NO; 

}

享受...