【问题标题】:ScrollView touch forwarding to UINavigationControllerScrollView 触摸转发到 UINavigationController
【发布时间】:2011-12-13 19:55:25
【问题描述】:

我想要做的是在导航栏上方放置一个滚动视图,但仍然让导航栏获得触摸输入。

我查看了响应者链,但条似乎不在其中。

FowardScrollView* _scrollView = [[FowardScrollView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 480.0f, 40.0f)];


UINavigationController* navController = [[UINavigationController alloc] initWithRootViewController: [[UIViewController alloc] init] ];
navController.topViewController.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"hello world" style:UIBarButtonItemStylePlain target:nil action:nil];
[navController.view setFrame:self.view.frame];
[self.view addSubview: navController.view];

[self.view addSubview: _scrollView];

然后在前视图的imp中

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{

    [self.nextResponder touchesBegan:touches withEvent:event];
//    [super touchesBegan:touches withEvent:event];
}

【问题讨论】:

    标签: ios uinavigationcontroller uiscrollview uinavigationbar


    【解决方案1】:

    如果您需要获取实际的触摸事件,例如,将其转发到导航栏,您始终可以覆盖 UIApplication 及其触摸处理方法。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多