Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
- // Insert code here to initialize your application
- NSScrollView *scrollView = [[NSScrollView alloc] init];
- [self.window.contentView addSubview:scrollView];
- [scrollView setFrame:NSMakeRect(0, 0, self.window.contentView.frame.size.width, self.window.contentView.frame.size.height)];
- [scrollView setHasHorizontalScroller:YES];
- NSView *documentView = [[NSView alloc] initWithFrame:NSMakeRect(0, 0, 1000, scrollView.frame.size.height)];
- [documentView setWantsLayer:YES];
- [documentView.layer setBackgroundColor:[NSColor redColor].CGColor];
- [scrollView setDocumentView:documentView];
- NSView *aView = [[NSView alloc] initWithFrame:NSMakeRect(10, 10, 30, 30)];
- aView.layer.backgroundColor = [NSColor blueColor].CGColor;
- [aView setWantsLayer:YES];
- [aView setNeedsLayout:YES];
- [aView setNeedsDisplay:YES];
- [scrollView addSubview:aView];
- //What I really want is [scrollView addFloatingSubview:aView forAxis:NSEventGestureAxisHorizontal]; but since the `addSubview` doesn't work, so the problem is not at the floating stuff.
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement