Nstty,

I think Alex was wondering where the identifier for the column is set which 
appears to be a string So if column 2 is identified as "Expenses" how does one 
associate the column with the identifier of "Expenses", so it can be used in 
the code he pprovided.
.


Jonathan Cohn 

> On Aug 30, 2015, at 10:06 AM, Barry Hadder <[email protected]> wrote:
> 
> If you are using a custom class, you set the class of the tableCellView in IB 
> in the identity inspector.  To find it in the outline, expand the tableview 
> and then the table column.
> After you design the cellView by adding elements and laying them out, you 
> will need to connect them to outlets in your custom class.
> 
> In your code, newCell needs to be the type of your custom class.  For example:
>               let newCell : customClass = 
> tableView.makeViewWithIdentifier(tableColumn!.identifier, owner:self) as! 
> customClass
> 
> The code you wrote should work, but will load a default cell.
> 
> 
> On Aug 29, 2015, at 9:38 PM, Alex Hall <[email protected]> wrote:
> 
> It can be, or you can use one of the pre-configured cells Apple provides. The 
> part I'm stuck on is how to tell Xcode that the cell I made--subclass or 
> default--is the one I want it to use to populate my table. There's a method 
> for it, and clearly I'm supposed to give it a string (as column.identifier) 
> which refers to my class. I'm just unsure where my class should live, and how 
> to set the identifier in IB in the first place. Here's the method:
> 
>       func tableView(tableView: NSTableView, viewForTableColumn tableColumn: 
> NSTableColumn?, row: Int) -> NSView? {
>               let 
> newCell:NSTableCellView=tableView.makeViewWithIdentifier(tableColumn!.identifier,
>  owner:self) as! NSTableCellView
>               newCell.textField!.stringValue=modelArray[row]
>               return(newCell)
>       }
> 
>> On Aug 29, 2015, at 10:12 PM, Jonathan C. Cohn <[email protected]> wrote:
>> 
>> Would it just be a subclass?
>> 
>> 
>> Jonathan Cohn 
>> 
>>> On Aug 29, 2015, at 8:43 PM, Alex Hall <[email protected]> wrote:
>>> 
>>> Don't ask me how, but I think I have it working. My raining question is: 
>>> how do you create, then use, a custom cell view? I'm using the default one 
>>> now, which is just a text field, and that's all I need for the moment. In 
>>> general, though, how would I go about making a custom cell view and then 
>>> using it?
>>>> On Aug 29, 2015, at 7:47 PM, Alex Hall <[email protected]> wrote:
>>>> 
>>>> One more update. I tried connecting my outlet, not to the table inside my 
>>>> view, but to the table in the clip view in the table in the view… If that 
>>>> makes sense. :) It suddenly started working, and now I have a table with 
>>>> two rows, just as my model specifies. The only problem is that these rows 
>>>> are showing text of "Table View Cell", rather than the text I want. 
>>>> Clearly, I'm missing something important about making custom cells (this 
>>>> is a view-based table, not a cell-based table, by the way). Still, we're 
>>>> getting there, i think.
>>>>> On Aug 29, 2015, at 7:43 PM, Alex Hall <[email protected]> wrote:
>>>>> 
>>>>> Thanks, see below.
>>>>>> On Aug 29, 2015, at 7:35 PM, Yuma Decaux <[email protected]> wrote:
>>>>>> 
>>>>>> Hi Alex,
>>>>>> 
>>>>>> Just to clarify, can you answer thee following:
>>>>>> 1-are you using a custom NStableCell to populate your NSTableView, and 
>>>>>> how are you calling NSTableViewCell through your delegate protocol?
>>>>> I'm creating the cell in my table delegate, but honestly I'm not clear on 
>>>>> the process. I know I should create a cell somewhere and set it up how I 
>>>>> want each row to look, but just how to do that is where I'm not following 
>>>>> the (visual) instructions I've found online. Right now, my tableView 
>>>>> method in the delegate/data source class just generates a new cell and 
>>>>> returns it, having set its stringValue attribute to the corresponding 
>>>>> item in the model's array. I have no idea if that'll actually work or not.
>>>>> 
>>>>>> 2-Are you using a subclass of NSTableView or are you using the .nib 
>>>>>> reference for your custom cell?
>>>>> I just put an NSTableView object from the library into my view, like 
>>>>> normal. In it I see a clip view, two scrollers, and a table header view. 
>>>>> The clip view appears to hold my actual table, which is quite confusing 
>>>>> as no instructions online mention this clip view at all, let alone that 
>>>>> it holds the actual table.
>>>>> 
>>>>>> 
>>>>>> This might help me understand better the issue.
>>>>>> 
>>>>>> Cheers,
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>>> On 30/08/2015, at 9:30 AM, Alex Hall <[email protected]> wrote:
>>>>>>> 
>>>>>>> Quick update. I changed the class of my outlet to NSScrollView, and 
>>>>>>> things connected straight away. I changed it back to NSTableView, and 
>>>>>>> the connection persisted. I'm now seeing a blank window (save the usual 
>>>>>>> Close and Minimize buttons) in my app, with no sign of the text field 
>>>>>>> and table I've added. I have no clue why my connection suddenly worked, 
>>>>>>> or why nothing is showing. In future, should I connect to something 
>>>>>>> other than the table view in the outline? Perhaps the table inside the 
>>>>>>> clip view?
>>>>>>>> On Aug 29, 2015, at 6:11 PM, Alex Hall <[email protected]> wrote:
>>>>>>>> 
>>>>>>>> Hi all,
>>>>>>>> Sorry to post this here, but it's the only place I know of where a few 
>>>>>>>> blind Xcode users might see it. Please respond off-list to 
>>>>>>>> [email protected]. Thanks.
>>>>>>>> 
>>>>>>>> I'm using Xcode 7 beta 6, and I have a table in a Mac app. The table 
>>>>>>>> was connected to an IBOutlet and showed as "connected in the ruler, 
>>>>>>>> then I was trying to put a cell in it to use as a data source view and 
>>>>>>>> it wasn't working. I eventually tried moving the table to the cell, 
>>>>>>>> rather than the cell to the table, and that's when my connection broke.
>>>>>>>> 
>>>>>>>> I have since tried re-connecting it several times, and have even 
>>>>>>>> deleted the table and added a new one. Nothing, though, seems to work. 
>>>>>>>> I have no idea why, as the process I'm using has worked consistently 
>>>>>>>> for months. Strangely, when I run the app, it runs, but focus never 
>>>>>>>> switches to it. If I command-tab to it, VoiceOver says the app's name, 
>>>>>>>> but I still seem to be in Xcode. Before, I could see an empty table, 
>>>>>>>> just as I'd expect, along with the other buttons and such in my app.  
>>>>>>>> None of this craziness happened until after the connection broke, and 
>>>>>>>> the only warnings I see are for some layout ambiguities. If anyone can 
>>>>>>>> suggest what I am doing wrong, or how to fix this perplexing problem, 
>>>>>>>> I'd be very grateful. Thanks in advance.
>>>>>>>> 
>>>>>>>> --
>>>>>>>> Have a great day,
>>>>>>>> Alex Hall
>>>>>>>> [email protected]
>>>>>>> 
>>>>>>> 
>>>>>>> --
>>>>>>> Have a great day,
>>>>>>> Alex Hall
>>>>>>> [email protected]
>>>>>>> 
>>>>>>> -- 
>>>>>>> You received this message because you are subscribed to the Google 
>>>>>>> Groups "MacVisionaries" group.
>>>>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>>>>> an email to [email protected].
>>>>>>> To post to this group, send email to [email protected].
>>>>>>> Visit this group at http://groups.google.com/group/macvisionaries.
>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>> 
>>>>>> -- 
>>>>>> You received this message because you are subscribed to the Google 
>>>>>> Groups "MacVisionaries" group.
>>>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>>>> an email to [email protected].
>>>>>> To post to this group, send email to [email protected].
>>>>>> Visit this group at http://groups.google.com/group/macvisionaries.
>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>> 
>>>>> 
>>>>> --
>>>>> Have a great day,
>>>>> Alex Hall
>>>>> [email protected]
>>>> 
>>>> 
>>>> --
>>>> Have a great day,
>>>> Alex Hall
>>>> [email protected]
>>> 
>>> 
>>> --
>>> Have a great day,
>>> Alex Hall
>>> [email protected]
>>> 
>>> -- 
>>> You received this message because you are subscribed to the Google Groups 
>>> "MacVisionaries" group.
>>> To unsubscribe from this group and stop receiving emails from it, send an 
>>> email to [email protected].
>>> To post to this group, send email to [email protected].
>>> Visit this group at http://groups.google.com/group/macvisionaries.
>>> For more options, visit https://groups.google.com/d/optout.
>> 
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "MacVisionaries" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected].
>> To post to this group, send email to [email protected].
>> Visit this group at http://groups.google.com/group/macvisionaries.
>> For more options, visit https://groups.google.com/d/optout.
> 
> 
> --
> Have a great day,
> Alex Hall
> [email protected]
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "MacVisionaries" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/macvisionaries.
> For more options, visit https://groups.google.com/d/optout.
> 
> Barry Hadder
> [email protected]
> 
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "MacVisionaries" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/macvisionaries.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"MacVisionaries" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/macvisionaries.
For more options, visit https://groups.google.com/d/optout.

Reply via email to