-2

I have a NSTableView with one column. As we know in cocoa, Table is column base. I want to create a login screen in cocoa with the help of table view in which there are two rows, one for username and another for password. I want to know how I use custom table in cocoa to create two rows.

Please help me out. Any help is appreciated.

Thanks

upender
  • 99
  • 1
  • 12

1 Answers1

4

1) Read the documentation and search Google for any one of thousands of examples for implementing the NSTableViewDataSource protocol. Post back with specific questions if you run into problems.

2) Reconsider why you chose NSTableView rather than standard textfields and labels or NSForm or even NSMatrix. Using an NSTableView in this way is not only strange but its implementation will be clunky and weird.

Let me back that last point up a bit. Dialogs - modal or not - usually only have a few fields. That's what fields and labels are for. If you find yourself dealing with a lot of same-type input fields, NSForm is a better fit but has a few gotcha's in your case. An NSTableView shows tables and a single column of two or three individually-labeled fields is not really a table. Just use text field and password field, slap labels on them, and be done with it. :-)

Joshua Nozzi
  • 60,946
  • 14
  • 140
  • 135