Ios Swift xcode错误“;未实现…故障预告无法识别的选择器-[FinalProjectDavid.RowTable initWithCoder:”;
我试图创建一个“登录”按钮,将用户传送到一个新窗口,该窗口有一个12行的表,但我得到了这个错误。segue的标识符是Ios Swift xcode错误“;未实现…故障预告无法识别的选择器-[FinalProjectDavid.RowTable initWithCoder:”;,ios,swift,Ios,Swift,我试图创建一个“登录”按钮,将用户传送到一个新窗口,该窗口有一个12行的表,但我得到了这个错误。segue的标识符是SignInButtonSecondSegue 文本格式错误: 2016-03-07 16:48:10.119 FinalProjectDavid[4030:429084]NSForwarding:警告:类“FinalProjectDavid.RowTable”的对象0x7fb0895b3a40未实现methodSignatureForSelector:--前方有故障 无法识别的选
SignInButtonSecondSegue
文本格式错误:
2016-03-07 16:48:10.119 FinalProjectDavid[4030:429084]NSForwarding:警告:类“FinalProjectDavid.RowTable”的对象0x7fb0895b3a40未实现methodSignatureForSelector:--前方有故障
无法识别的选择器-[FinalProjectDavid.RowTable initWithCoder:]
(lldb)
错误截图:
情节提要的屏幕截图:
这是附加到登录/登录窗口/视图的登录/登录按钮类
import MessageUI
import UIKit
class ViewController: UIViewController, MFMailComposeViewControllerDelegate
{
override func viewDidLoad() {
super.viewDidLoad()
//Looks for single or multiple taps.
let tap: UITapGestureRecognizer = UITapGestureRecognizer(target: self, action: "dismissKeyboard")
view.addGestureRecognizer(tap)
}
//Calls this function when the tap is recognized.
func dismissKeyboard() {
//Causes the view (or one of its embedded text fields) to resign the first responder status.
view.endEditing(true)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
@IBOutlet weak var ClickHereSendEmailButton: UIButton!
@IBOutlet weak var Label: UILabel!
@IBOutlet weak var UsernameTextField: UITextField!
@IBOutlet weak var PasswordTextField: UITextField!
@IBOutlet weak var SignInButton: UIButton!
@IBAction func PressedSignInButton(sender: UIButton)
{
if UsernameTextField.text == username && PasswordTextField.text == password
{
performSegueWithIdentifier("SignInButtonSecondSegue", sender: nil) //this is where I get the error
Label.text = "The credentials are correct."
UsernameTextField.resignFirstResponder()
PasswordTextField.resignFirstResponder()
}
else
{
// create the alert
let alert = UIAlertController(title: "Incorrect", message: "Your credentials are incorrect.", preferredStyle: UIAlertControllerStyle.Alert)
// add an action (button)
alert.addAction(UIAlertAction(title: "Okay", style: UIAlertActionStyle.Default, handler: nil))
// show the alert
self.presentViewController(alert, animated: true, completion: nil)
Label.text = "The credentials are not correct."
UsernameTextField.resignFirstResponder()
PasswordTextField.resignFirstResponder()
}
}
@IBAction func PressedClickHereSendEmailButton(sender: UIButton)
{
let mailComposeViewController = configuredMailComposeViewController()
if MFMailComposeViewController.canSendMail() {
self.presentViewController(mailComposeViewController, animated: true, completion: nil)
} else {
self.showSendMailErrorAlert()
}
}
func configuredMailComposeViewController() -> MFMailComposeViewController {
let mailComposerVC = MFMailComposeViewController()
mailComposerVC.mailComposeDelegate = self // Extremely important to set the --mailComposeDelegate-- property, NOT the --delegate-- property
mailComposerVC.setToRecipients(["nurdin@gmail.com"])
mailComposerVC.setSubject(" \(UsernameTextField.text), \(PasswordTextField.text)")//unwrap
mailComposerVC.setMessageBody("Sending e-mail in-app is not so bad!", isHTML: false)
return mailComposerVC
}
func showSendMailErrorAlert() {
let sendMailErrorAlert = UIAlertView(title: "Could Not Send Email", message: "Your device could not send e-mail. Please check e-mail configuration and try again.", delegate: self, cancelButtonTitle: "OK")
sendMailErrorAlert.show()
}
// MARK: MFMailComposeViewControllerDelegate
func mailComposeController(controller: MFMailComposeViewController, didFinishWithResult result: MFMailComposeResult, error: NSError?) {
controller.dismissViewControllerAnimated(true, completion: nil)
}
}
行表类:
import UIKit
class RowTable
{
init() // since it is overriding the NSObject init
{
}
func viewDidLoad() {
viewDidLoad()
// Uncomment the following line to preserve selection between presentations
// self.clearsSelectionOnViewWillAppear = false
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem()
}
func didReceiveMemoryWarning() {
didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
// MARK: - Table view data source
func numberOfSectionsInTableView(tableView: UITableView) -> Int {
// #warning Incomplete implementation, return the number of sections
return 1
}
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
// #warning Incomplete implementation, return the number of rows
return 12
}
func methodSingatureForSelector()
{
}
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("FileSlot", forIndexPath: indexPath)
2
let filename = rows[indexPath.row].FileName
let button = UIButton(type: .System)
button.frame = CGRectMake(100, 100, 100, 50)
button.backgroundColor = UIColor.greenColor()
button.setTitle("Test Button", forState: UIControlState.Normal)
button.addTarget(self, action: "buttonAction", forControlEvents:UIControlEvents.TouchUpInside)
// self.view.addSubview(button)
return cell
}
/*
// Override to support conditional editing of the table view.
override func tableView(tableView: UITableView, canEditRowAtIndexPath indexPath: NSIndexPath) -> Bool {
// Return false if you do not want the specified item to be editable.
return true
}
*/
/*
// Override to support editing the table view.
override func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) {
if editingStyle == .Delete {
// Delete the row from the data source
tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: .Fade)
} else if editingStyle == .Insert {
// Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
}
}
*/
/*
// Override to support rearranging the table view.
override func tableView(tableView: UITableView, moveRowAtIndexPath fromIndexPath: NSIndexPath, toIndexPath: NSIndexPath) {
}
*/
/*
// Override to support conditional rearranging of the table view.
override func tableView(tableView: UITableView, canMoveRowAtIndexPath indexPath: NSIndexPath) -> Bool {
// Return false if you do not want the item to be re-orderable.
return true
}
*/
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
*/
}
行类:
import UIKit
let rows = [
Row(FileName: "File slot 1",
QuartzImage: "Image slot 1"),
Row(FileName: "File slot 2",
QuartzImage: "Image slot 2"),
Row(FileName: "File slot 3",
QuartzImage: "Image slot 3"),
Row(FileName: "File slot 4",
QuartzImage: "Image slot 4"),
Row(FileName: "File slot 5",
QuartzImage: "Image slot 5"),
Row(FileName: "File slot 6",
QuartzImage: "Image slot 6"),
Row(FileName: "File slot 7",
QuartzImage: "Image slot 7"),
Row(FileName: "File slot 8",
QuartzImage: "Image slot 8"),
Row(FileName: "File slot 9",
QuartzImage: "Image slot 9"),
Row(FileName: "File slot 10",
QuartzImage: "Image slot 10"),
Row(FileName: "File slot 11",
QuartzImage: "Image slot 11"),
Row(FileName: "File slot 12",
QuartzImage: "Image slot 12")]
class Row
{
///// enum Type: String {
// }
var FileName: String
var QuartzImage: String
// var type: Type
// var shortDescription: String
// var longDescription: String
init(FileName: String, QuartzImage: String) {
self.FileName = FileName
self.QuartzImage = QuartzImage
}
}
编辑:刚刚添加了行和行表类,很抱歉之前没有提供足够的代码/信息 如果希望
RowTable
成为表视图控制器子类,则需要指出这一点<代码>类行表:UITableViewController。谢谢,解决了错误。