“无法识别的选择器发送到实例”在swift

“无法识别的选择器发送到实例”在swift,第1张

概述我不知道我在做错什么我也很新的编程,所以我不是很好的调试。这是一个测试应用程序,以便我可以看到应用程序开发有多快。到目前为止,我已经得到了: class ViewController: UIViewController, UITextViewDelegate { var textView: UITextView! init(nibName nibNameOrNil: Strin 我不知道我在做错什么我也很新的编程,所以我不是很好的调试。这是一个测试应用程序,以便我可以看到应用程序开发有多快。到目前为止,我已经得到了:
class VIEwController: UIVIEwController,UITextVIEwDelegate {    var textVIEw: UITextVIEw!    init(nibname nibnameOrNil: String?,bundle nibBundleOrNil: NSBundle?) {        super.init(nibname: nibnameOrNil,bundle: nibBundleOrNil)    }    overrIDe func vIEwDIDLoad() {        super.vIEwDIDLoad()        var wIDthFIEld = self.vIEw.bounds.size.wIDth - 10        var heightFIEld = self.vIEw.bounds.size.height - 69 - 221        var textFIEldString: String! = ""        //Set up text fIEld        self.textVIEw = UITextVIEw(frame: CGRectMake(5,64,wIDthFIEld,heightFIEld))        self.textVIEw.backgroundcolor = UIcolor.redcolor()        self.vIEw.addSubvIEw(self.textVIEw)        //Set up the New button        var newbuttonString: String! = "New Note"        var heightbutton = 568 - heightFIEld - 1000        let newbutton = UIbutton(frame: CGRect(x: 5,y: 5,wIDth: wIDthFIEld,height: 50)) as UIbutton        UIbutton.buttonWithType(UIbuttonType.System)        newbutton.setTitle(newbuttonString,forState: UIControlState.normal)        newbutton.backgroundcolor = UIcolor.redcolor()        newbutton.addTarget(self,action: "buttonAction:",forControlEvents: UIControlEvents.touchUpInsIDe)        self.vIEw.addSubvIEw(newbutton)    }    func buttonAction() {        println("tapped button")    }}

当我按下iOS模拟器中的按钮时,我收到错误“无法识别的选择器发送到实例”。该应用程序打开正常,但按下按钮,它只是崩溃。

func buttonAction(){...

应该

func buttonAction(sender:UIbutton!){    println("tapped button")}

因为newbutton的动作:“buttonAction”,所以。

总结

以上是内存溢出为你收集整理的“无法识别的选择器发送到实例”在swift全部内容,希望文章能够帮你解决“无法识别的选择器发送到实例”在swift所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1053977.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-25
下一篇 2022-05-25

发表评论

登录后才能评论

评论列表(0条)

保存