我有分页一个UIScrollView像下面启用:UIScrollView的内容不允许用户交互
container = [[UIScrollView alloc] initWithFrame:kScrollViewFrame];
[container setDelegate:self];
[container setShowsHorizontalScrollIndicator:YES];
[container setShowsVerticalScrollIndicator:NO];
[container setClipsToBounds:YES];
[container setPagingEnabled:YES];
[container setDecelerationRate:UIScrollViewDecelerationRateFast];
[container setBounces:NO];
[container setUserInteractionEnabled:NO];
[container setCanCancelContentTouches:NO];
[container setDelaysContentTouches:NO];
到的UIScrollView,我添加几个UIWebViews中,并设置启用它们之间的相互作用是像这样。
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
// Initialization code
self.frame = frame;
self.userInteractionEnabled = YES;
}
return self;
}
这打破了分页和所有接触UIScrollView。如果我将用户交互设置为NO,页面可以工作,但我无法在UIWebView中突出显示文本。我试着像下面这样继承UIScrollView,但情况相同。任何想法?
- (id)initWithFrame:(CGRect)frame
{
NSLog(@"init");
return [super initWithFrame:frame];
}
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
NSLog(@"touchesBegan");
[[self nextResponder] touchesBegan:touches withEvent:event];
}
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
NSLog(@"touchesMoved");
[[self nextResponder] touchesMoved:touches withEvent:event];
}
- (void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
NSLog(@"touchesEnded");
[[self nextResponder] touchesEnded:touches withEvent:event];
}
它是什么你试图实现,你需要滚动视图滚动,Web视图滚动,分页,选择?请更具体一些。 – 2012-04-04 15:10:03
我需要滚动视图页面和用户能够选择WebVies上的文本(这是滚动视图的子视图)Webview不需要滚动,只需能够选择其文本。 – 2012-04-04 15:37:14
我编辑了我的答案以反映您的要求,它似乎对我有用。 – 2012-04-04 15:49:27