在NSScrollView子类中尝试此操作:
- (void)scrollWheel:(NSEvent *)theEvent
{
[super scrollWheel:theEvent];
if ([theEvent deltaY] != 0.0)
{
[[self nextResponder] scrollWheel:theEvent];
}
}
Run Code Online (Sandbox Code Playgroud)
您也可以通过以下方式登录:
NSLog(@"user scrolled %f horizontally and %f vertically", [theEvent deltaX], [theEvent deltaY]);
Run Code Online (Sandbox Code Playgroud)
das*_*dom -1
您可以观察scrollViewDidScroll:中的内容偏移量并将x值设置为您喜欢的值。
编辑:好的,那么。你见过这个:约束滚动吗?
| 归档时间: |
|
| 查看次数: |
6482 次 |
| 最近记录: |