Tag: 超类

Swift:表视图超类错误

我用Swift创build了一个滑出菜单。 我以前做过这么多次,但是当我今天创build它的时候,我得到这个错误(见截图)。 这可能只是我犯的一个简单的错误。 这是代码,我认为是造成这个问题: override func tableView(tableView: UITableView!, cellForRowAtIndexPath indexPath: NSIndexPath!) -> UITableViewCell! { var cell:UITableViewCell? = tableView.dequeueReusableCellWithIdentifier("Cell")! as UITableViewCell if cell == nil{ cell = UITableViewCell(style: UITableViewCellStyle.Default, reuseIdentifier: "Cell") cell!.backgroundColor = UIColor.clearColor() cell!.textLabel!.textColor = UIColor.darkTextColor() let selectedView:UIView = UIView(frame: CGRect(x: 0, y: 0, width: cell!.frame.size.width, height: cell!.frame.size.height)) selectedView.backgroundColor = UIColor.blackColor().colorWithAlphaComponent(0.3) cell!.selectedBackgroundView = selectedView } […]