Reputation: 75
I'm working on a menubar note-taking app with Simplenote syncing support, and it's been using a separate title and content for each note. It shows the title in an NSTableView and the content in an NSTextView, but now I would like for it to show the content as the title in the table view like in Simplenote. My problem is that I would like for it to show the title only up until it reaches a newline, but I don't know how to do it.
Upvotes: 0
Views: 248
Reputation: 46728
Simplest way is to break apart the string using -componentsSeparatedByString:
and pass in \n
which will return an array with the components broken apart. Then grab the zeroth element from the array.
Upvotes: 1