Group Group Group Group Group Group Group Group Group

raywenderlich.com Forums

NSOutlineView on OS X Tutorial

Discover how to display and interact with hierarchical data on OS X with this NSOutlineView on OS X tutorial.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/1201-nsoutlineview-on-macos-tutorial

Love these OS X specific tutorials! and this one is even better since there are so few examples on this control.

thx!

Thanks for the tutorial. A question - the textField.sizeToFit() does not seem to work, even in your final project version. I am using OS X 10.11.4 running Xcode 7.3.

Thanks,

Tom

Great to hear that you like our OS X tutorials and you are right, there is a big lack of good resources, especially for NSOutlineView. But we do our best to fill this gap and i hope at some day this site will also be the first stop if someone is looking for OS X specific tutorials like it is for iOS.

What do you mean with it doesn’t work? When i run the final project all seems to be ok. The textfield has the correct size, but you have to resize the column of the outline view.

My apology - my misunderstood, I thought the column will expand automatically to fit the length of the text. Sorry!

No problem, if you select a column in IB e.g Feed you can set the width of a column inside the size inspector. With the constraints setting you can specify a minimum and maximum size for each column. On the outline view you can also set the “Autoresizes” property for each row and you can play a bit with different values for columnAutoresizingStyle.

Hi Jean Pierre!
First of all, thank you so much for the tutorial! It is a very good exercise and an easy way to learn, it is very well explained.

Everything works fine, but when I tried the last part of the exercises, the one to delete a Feed Item or Feed, it worked very well for a Feed Item but not for a Feed (I got a run time error). Then I decided to download the final project from the link provided, I built the project and ran it, and surprisingly I got the same run time error.

I am using Xcode version 7.3.1 and OS X El Capitan 10.11.4

Thank you so much again!
Mauricio

Hi Mauricio,

great that you like the tutorial. I tried to reproduce the error but for me everything works well. I use the same Xcode and OS X version. Can you add an exception breakpoint and post any error message you receive?

Pierre

Hi Pierre!

Sorry for the delay, I was very busy. At the end, I do not know what happened but now it is working without any error.

Thank you so much and please keep going with these valuable tutorials!

Regards,
Mauricio