I had a class called OptionsTableViewController which inherited UITabl开发者_JS百科eViewController. I changed the superclass to UIViewController implementing the UITableViewDelegate and UITableViewDataSource protocols, because I needed the tableView to be in a specific position.
Now some table cells have a UISwitch as accessoryView. The switch is an instance variable, initialized With CGRectZero.
When changing the superclass to UIViewController the switches are not shown. But when I also rename the class (to OptionsViewController f. e.) it works.
Does anybody know where this strange behavior comes from? I also tried to clean the project and I even deleted the build folder - but it seems, that the only solution is to rename the class.
I had a similar problem before, where the whole table view would not be shown unless the class was renamed.
Did you check to see if the names OptionsTableViewController and OptionsViewController are used anywhere else in your entire project, including in Interface builder nib files? Did you change all the names, as appropriate?
I found the reason for this problem. Although searching through the project XCode wouldn't find any files named OptionsTableViewController, but I found it included under Targets -> AppName. The file wouldn't disappear after Clean All Targets, so it is good to know that there still remain parts in there.
精彩评论