6

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

Björn Kaiser
  • 9,882
  • 4
  • 37
  • 57
  • 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 Feb 22 '13 at 01:42
  • 1
    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 http://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 Feb 22 '13 at 12:34
  • I found that my problem was actually a dup of this [question](http://stackoverflow.com/questions/4366796/blue-border-appearing-around-nsscrollview?rq=1). – Chuck H Feb 22 '13 at 16:32

3 Answers3

8

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;
chrs
  • 5,906
  • 10
  • 43
  • 74
1

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

Community
  • 1
  • 1
Fangming
  • 24,551
  • 6
  • 100
  • 90
0

For Swift 3 :-

collectionView.enclosingScrollView?.borderType = .noBorder
Jay Mehta
  • 1,511
  • 15
  • 20