I’m trying to create a tableview that has different cells, depending on what else is happening, so as I couldn’t find a way to hide ones I don’t need with a static table view, I thought I’d use the dynamic type. I’ve added a subclass for the first cell, but can’t seem to get the referencing outlet to connect.
I’m doing something similar to the section “Using a Subclass for the Prototype Cell” in http://www.raywenderlich.com/5138/beginning-storyboards-in-ios-5-part-1 but when I try in Xcode to set the class, it doesn’t see my custom class and even if I type the right name, I still can’t see the label’s references when I try to connect the referencing outlet, so any idea what I might be missing?
Thanks John that put me on the right path. I’d created it in a new file for the subclass, which was the problem. When I added the [IBObject] and moved it into the same files as the view controller, it can see it now.
I’m obviously missing something still. I created a sample, which is the standard master/detail template but I’ve changed the prototype cell to be a custom cell, with (for the sake of an example) a UITextfield instead of the normal text.
I’ve created a class called myCell for it and hooked things up in IB, but when I try to reference it in cellForRowAtIndexPath, it doesn’t work.
If anyone can look at this and see what I’m missing, I’ll be eternally grateful ! UniversalApp2.zip (134.5 KB)
method MasterViewController.tableView(tableView: UITableView) cellForRowAtIndexPath(indexPath: NSIndexPath): UITableViewCell;
begin
var CellIdentifier := "myCell";
var someCell := myCell(tableView.dequeueReusableCellWithIdentifier(CellIdentifier));
//if not assigned(result) then
// result := new myCell withStyle(UITableViewCellStyle.UITableViewCellStyleDefault) reuseIdentifier(CellIdentifier);
var lObject := fObjects[indexPath.row];
someCell.myField:text:=lObject.description;
//result.textLabel.text := lObject.description;
exit someCell;
end;