6
votes

As you can see in the screenshot below, the NSCollectionView I used has some kind of border (the thin gray lines) I want to get rid of. Can somebody tell me how to achieve this? I already tried subclassing the NSCollectionView and tried to overwrite it in the drawRect: by using [[super layer] setBorderWidth:0.0f]; but this did not work.

enter image description here

Searching on Google, SO and the Apple Documentation did not help either. So did anyone achieved this already or knows where I can find an example of how to do it?

Thanks in advance, Björn

3
Did you ever solve this? I am having the same problem except my border is blue. It's along the left and top only.Chuck H
I did not work on the project for a few months but with the latst version of Xcode you can disable the border in Interface Builder. Just select the Scroll View and then disable the border like in this screenshot cl.ly/image/3W232g2P0e0f. After you've done that it should disappear. I was either blind last year or they simply changed it in the current Xcode version :-)Björn Kaiser
I found that my problem was actually a dup of this question.Chuck H

3 Answers

8
votes

The collectionView is nested in a NSScrollView, which has a borderType property. You can get rid of the border by simply setting its border type to NSNoBorder.

self.collectionView.enclosingScrollView.borderType = NSNoBorder;
1
votes

From story board:

  1. Select the scroll view from story board

enter image description here

  1. Then choose no boarder from Attributes Inspector

enter image description here

0
votes

For Swift 3 :-

collectionView.enclosingScrollView?.borderType = .noBorder