简体   繁体   中英

Xcode 6.1: UITableViewcontroller template empty

When I try to generate a new UITableViewController in Xcode 6.1 for an IOS 8.1 iPhone project with

File->New->File->Cocoa Class and then select "Subclass of UITableViewController ", Language Swift , I get a source file like this:

//
//  xxx.swift
//  project
//
//  Created by Olaf Klein on 29/10/14.
//  Copyright (c) 2014 Olaf Klein. All rights reserved.
//

import Cocoa

class xxx: UITableViewController {

}

Of course I expected a much bigger class with some methods - reinstalling Xcode doesn't change anything - any hints?

You're choosing the wrong file type to add. Cocoa is the framework for OS X development, and it has no UITableViewController class, so there is no template, and the Cocoa module will not be included in your project.

From the new file dialogue you have to choose from the iOS section, a new Cocoa Touch file, I think (away from my Mac at the moment, and they keep changing the arrangement of that section).

This will give you the proper template.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM