NSTableView with overlapping corner views has odd scrolling - cocoa

I'm trying to implement an NSTableView with rounded corners. The approach I took was to put a container on top of the table view that has images only on the corners to produce the rounded effect. The problem I'm having is that when the table scrolls, the corner images scroll with the row they were drawn on. Does anyone have insights as to why this is occurring?
Edit: I tried putting a button in the center of the corner image container and it seems like the NSScrollView is going on top when it's scrolling. When it scrolls, the button is also disappearing from the view. Is the scroll view known to do this?

Solved. I took the approach of creating a child window overlay. An example of this: http://lists.apple.com/archives/Cocoa-dev/2006/Apr/msg01638.html

Related

Scroll issue on display grid in flex container

I noticed a scroll issue when a display grid element is child of a flex one.
Here an example to explain the problem
As you can see in this screenshot, the scroll bar is at its maximum top position but the some of the grid content are hidden and there's no way to scroll them into view.
I have to use a flex box because my goal is to keep the grid centered horizontally and vertically
Any idea to solve?

How to set the width of a Round Textured Button in an NSToolbar

How do you set the width of a Round Textured Button in an NSToolbar, that is, set the width so that it is actually kept at run-time? If I drag a Rounded Textured Button and drop it on an NSToolbar. I've set the width to 25 for both the Custom View/Toolbar Item and the Round Textured Button within it, but as soon as you run the app, the button looks to be three times the width it should be.
I was going to post pictures but I have insufficient reputation points. I hope somebody can figure it out without pictures.
I'm using XCode 6.1.1. Thanks.
The anomaly was caused by my use of 64x64 images. Even though it appeared to scale it properly, the stretching of the button must have occurred first before downscaling the image. If I set the button to NSActionTemplate, for example, the button is correctly sized. I'll look for more appropriately-sized images.

How to pan a zoomed out UIImageView inside an UIScrollView?

I have an UIScrollView which contains one UIImageView. Everything is working correctly, I can zoom in and out, when zoomed in I can pan around, etc.
The problem that I am unable to solve is how to pan a zoomed out image around the screen. The user needs to be able to zoom the image out until it's small, and then move that small image to any point on the screen. Sadly, it's stuck in the center of the screen (usually, it would be stuck in the top left corner but I did fix that problem).
There are a couple of things you need to do here. I suggest doing them in viewWillAppear rather than viewDidLoad because if you're using storyboards, it doesn't work quite right in viewDidLoad.
First, you need to set the content size property of your scroll view to be the size of the photo itself because you want the entire area of your photo to be scrollable.
self.scrollView.contentSize=self.photoShown.size;
photoShown is UIImage. scrollView is a UIScrollView
Second, you need to set the frame of your UIImageView that houses your image to be the size of your image:
self.imageView.frame=CGRectMake(0,0, self.photoShown.size.width, self.photoShown.size.height);
if you haven't done this, then the frame of the UIImageView is the size of the screen itself and there is simply nowhere to pan. That's why it needs to be bigger, so you can pan to the regions not currently shown on screen.

UITableView won't scroll on iPad, but does on iPhone

If I turn my iPad to landscape a couple of row of table view (and the footer) are just off the bottom of the screen although it fits in portrait.
My problem is that when I use my finger to "pull" view port up to see the material off the bottom I can see it while I keep my finger in place, but when I remove the finger, the viewport drops down again and the material at the bottom disappears.
Same code scrolls fine on iPhone (fonts are too big and so on but that is a different issue)
What am I doing wrong?
Peter
As for what exactly your doing wrong... we can't see your code so we can't tell you. But shed some light on what is happening.
A UITableView is a UIScrollView and how far you can scroll is based on the size view (think frame) compared to the size(CGSize) of the content(contentSize) of the UIScrollView. If the 'frame' is bigger than the contentSize then no scrolling is needed, but if the content is larger, then you can scroll by the difference between the two.
In short, the contentSize of your UITableView is incorrect. This can be caused numerous ways, including auto-resizing on device rotations, dynamically changing table/footer heights without updating the table, etc.

Padding at top of NSView in an NSScrollView

I have an NSView as the document of an NSScrollView. I would like to have a few pixels of padding at the top and bottom of the visible part of the view, regardless of where the scroller is positioned (not just at the top and bottom of the document as described here). For an example of an app that does this, look at Terminal.app. Regardless of the background color of the text, the top two visible rows of pixels are always the default background color.
I know I could simply draw everything two pixels lower and draw a rectangle at the top and bottom of the document-visible rect, but that will require changing a lot of complex code that I didn't write. Simpler ideas are welcomed!
The answer to the question you linked is actually a good solution for this problem too. In fact if your view is anything but an NSTextView, I'd say it's easier to implement.
Specifically: make your actual document view a subview of some other view, leaving room around the edges and make that view the scroll view's document view. If your content view (the one you wish to pad) changes sizes, have your "padding view" observe it for frame changes and resize to maintain the padding.
2015 Update
Content inset has been added to NSScrollView as of 10.10, making my older answer obsolete.

Resources