私は単純な作業であると思ったことに固執しています。 UITableView
はPrototype Cellに設定されています。プロトタイプセルに接続しているときにセルエラーをデキューできません
「ケース」に特定の用途のためにいくつかのセルを追加しました。
"識別子TankStartCell
のセルをデキューできません - 識別子のためにペンまたはクラスを登録するか、ストーリーボードにプロトタイプセルを接続する必要があります"というエラーが表示されますが、シーンはプロトタイプセルとして設定されます。
問題のセルに識別子に "StartTankCell"があります。
ロケーションセルが機能します。
私が追加しようとしている: self.tableView.registerClass(UITableViewCell.self、forCellReuseIdentifier: "StartTankCell") が、ノー行きます。 クラスをUIViewController
にして、UITableViewDelegate
を追加しようとしましたが、行っていません。
private let NumberOfSections: Int = 6
private let NumberOfRowsInSection0: Int = 1
private let NumberOfRowsInSection1: Int = 4
private let NumberOfRowsInSection2: Int = 5
private let NumberOfRowsInSection3: Int = 6
private let NumberOfRowsInSection4: Int = 8
private let NumberOfRowsInSection5: Int = 1
// Section 0 Cells
private let DiveLocationIndex: NSIndexPath = NSIndexPath(forRow: 0, inSection: 0)
// Section 1 Cells
private let DiveStartingPressureIndex: NSIndexPath = NSIndexPath(forRow: 0, inSection: 1)
private let DiveEndingPressureIndex: NSIndexPath = NSIndexPath(forRow: 1, inSection: 1)
private let DiveTempPickerIndexAir: NSIndexPath = NSIndexPath(forRow: 2, inSection: 1)
private let DiveTempPickerIndexWater: NSIndexPath = NSIndexPath(forRow: 3, inSection: 1)
// Section 2 Cells
private let DiveWaterIndex: NSIndexPath = NSIndexPath(forRow: 0, inSection: 2)
private let DiveWeatherIndex: NSIndexPath = NSIndexPath(forRow: 1, inSection: 2)
private let DiveSurfaceIndex: NSIndexPath = NSIndexPath(forRow: 2, inSection: 2)
private let DiveCurrentsIndex: NSIndexPath = NSIndexPath(forRow: 3, inSection: 2)
private let DiveVisibilityIndex: NSIndexPath = NSIndexPath(forRow: 4, inSection: 2)
// Section 3 Cells
private let DiveEntryTypeIndex: NSIndexPath = NSIndexPath(forRow: 0, inSection: 3)
private let DiveWeightIndex: NSIndexPath = NSIndexPath(forRow: 1, inSection: 3)
private let DiveDiveSuitIndex: NSIndexPath = NSIndexPath(forRow: 2, inSection: 3)
private let DiveCircuitIndex: NSIndexPath = NSIndexPath(forRow: 3, inSection: 3)
private let DiveAirTypeIndex: NSIndexPath = NSIndexPath(forRow: 4, inSection: 3)
private let DiveDiveTypeIndex: NSIndexPath = NSIndexPath(forRow: 5, inSection: 3)
// Section 4 Cells
private let DiveMasterTitleIndex: NSIndexPath = NSIndexPath(forRow: 0, inSection: 4)
private let DiveMasterIndex: NSIndexPath = NSIndexPath(forRow: 1, inSection: 4)
private let DiveCenterTitleIndex: NSIndexPath = NSIndexPath(forRow: 2, inSection: 4)
private let DiveCenterIndex: NSIndexPath = NSIndexPath(forRow: 3, inSection: 4)
private let DiveBoatTitleIndex: NSIndexPath = NSIndexPath(forRow: 4, inSection: 4)
private let DiveBoatIndex: NSIndexPath = NSIndexPath(forRow: 5, inSection: 4)
private let DiveTripTitleIndex: NSIndexPath = NSIndexPath(forRow: 6, inSection: 4)
private let DiveTripIndex: NSIndexPath = NSIndexPath(forRow: 7, inSection: 4)
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell{
var cell: UITableViewCell!
switch indexPath
{
// Section 0
case DiveLocationIndex:
cell = tableView.dequeueReusableCellWithIdentifier(Resource.LocationCell)
cell.textLabel!.text = "Location".localized
cell.detailTextLabel!.text = String(format: "%f, %f", self.latitude, self.longitude)
// Section 1
case DiveStartingPressureIndex:
let cell : DiveStartTankPressureTableViewCell = tableView.dequeueReusableCellWithIdentifier("TankStartCell", forIndexPath: indexPath) as! DiveStartTankPressureTableViewCell
cell.lbl_Start_Pressure.text = Strings.StartingPressure.localized
cell.txtStartPressure_Symbol.placeholder = "PSI/Bar"
cell.txtStartPressure.text = userDefault.objectForKey("startPressure") as? String
cell.txtStartPressure_Symbol.text = userDefault.objectForKey("symbol_startPressure") as? String
userDefault.synchronize()
return cell
は私のDiveStartTankPressureTableViewCell
は、次のようになります。
class DiveStartTankPressureTableViewCell: UITableViewCell {
@IBOutlet weak var lbl_Start_Pressure: UILabel!
@IBOutlet weak var txtStartPressure: UITextField!
@IBOutlet weak var txtStartPressure_Symbol: UITextField!
private(set) var startingTank : String?
private(set) var startingTankSymbol : String?
// ---------------------------------------------------------------------------------------------
// MARK: - UITableVieCell Methods
//
// Called when we are initialized from a storyboard or nib file.
//
override func awakeFromNib()
{
super.awakeFromNib()
}
//
// The item has been selected in the table.
//
override func setSelected(selected: Bool, animated: Bool)
{
super.setSelected(selected, animated: animated)
}
// ---------------------------------------------------------------------------------------------
// MARK: - UITextFieldDelegate Method Implementation
//
// We are called when the user is done editing.
//
func textFieldDidEndEditing(textField: UITextField)
{
startingTank = txtStartPressure.text
startingTankSymbol = txtStartPressure_Symbol.text
itemToParse()
}
override func encodeWithCoder(aCoder: NSCoder) {
aCoder.encodeObject(startingTank, forKey: "startingTank")
aCoder.encodeObject(startingTankSymbol, forKey: "startingTankSymbol")
}
func itemToParse() {
let updateDiveQuery = PFQuery(className: "divelog")
updateDiveQuery.whereKey("uuid", equalTo: diveUUID)
updateDiveQuery.getFirstObjectInBackgroundWithBlock {(objects: PFObject?, error: NSError?) -> Void in
if error == nil {
if let updateDiveObject = objects {
updateDiveObject["startingTank"] = self.startingTank
updateDiveObject["startingTankSymbol"] = self.startingTankSymbol
updateDiveObject.pinInBackground()
updateDiveObject.saveInBackgroundWithBlock {(done:Bool, error:NSError?) in
if done {
print ("ParseData UPDATED data saved")
} else {
updateDiveObject.saveEventually()
}
}
if PFUser.currentUser()!.username == nil {
updateDiveObject["username"] = "Not Signed in"
} else {
updateDiveObject["username"] = PFUser.currentUser()!.username
}
updateDiveObject.saveEventually()
}
}
}
}
}
任意のアイデアを見て?
EDIT、私のストーリーボード
興味深いアップデートのスクリーンショットを追加します。私は、「プレーン」とない「グループ」を試してみましたエラーは以下に変更..
Could not cast value of type 'UITableViewCell' (0x10623e278) to 'RLA_DiveLog.DiveStartTankPressureTableViewCell' (0x1022fb330).
他のプロトタイプのセルは動作していますか?もしそうなら、あなたのセル識別子のスペル&ケースを慎重にチェックしてください。 – Paulw11
これはリストの最初のものなのか分かりません。 LocationCellは機能しますが、別の形式です。しかし、それはまだdequeueReusableCellWithIdentifierです。それが私を困惑させるものです。私は何度もスペルチェックをしました。 –
ちょっとしたお知らせ:Parseフレームワークを使用しています。彼らのサービスは2017年1月以降に閉鎖されていることをご存知ですか? Parseサーバをバックエンドにデプロイしていない限り、あなたのアプリはそれまでには廃止されるでしょう:) – Cabus