这是我尝试在Xcode上运行的代码,其想法是当我按下按钮时,它将显示背景和徽标,但是,当我按下按钮时,它直接将我带入错误
import UIKit
class ViewController: UIViewController {
@IBOutlet weak var coolLogo: UIImageView!
@IBOutlet weak var coolBg: UIImageView!
@IBOutlet weak var uncoolButton: UIButton!
override func viewDidLoad() {
super.viewDidLoad()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
@IBAction func makeMeNotSoUncoolButton(sender: AnyObject) {
coolLogo.hidden = false
coolBg.hidden = false
uncoolButton.hidden = true
print ("Its running")
}
}
这是我收到的错误
2016-06-29 10:19:01.229 SuperCool[1950:40240] -
[SuperCool.ViewController uncoolButton:]: unrecognized selector sent to instance 0x7fc4e9544fc0
2016-06-29 10:19:01.238 SuperCool[1950:40240] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[SuperCool.ViewController uncoolButton:]: unrecognized selector sent to instance 0x7fc4e9544fc0'
*** First throw call stack:
(
0 CoreFoundation 0x000000010f617d85 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x00000001113bbdeb objc_exception_throw + 48
2 CoreFoundation 0x000000010f620d3d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x000000010f566cfa ___forwarding___ + 970
4 CoreFoundation 0x000000010f5668a8 _CF_forwarding_prep_0 + 120
5 UIKit 0x000000010fe41a8d -[UIApplication sendAction:to:from:forEvent:] + 92
6 UIKit 0x000000010ffb4e67 -[UIControl sendAction:to:forEvent:] + 67
7 UIKit 0x000000010ffb5143 -[UIControl _sendActionsForEvents:withEvent:] + 327
8 UIKit 0x000000010ffb4263 -[UIControl touchesEnded:withEvent:] + 601
9 UIKit 0x000000010feb499f -[UIWindow _sendTouchesForEvent:] + 835
10 UIKit 0x000000010feb56d4 -[UIWindow sendEvent:] + 865
11 UIKit 0x000000010fe60dc6 -[UIApplication sendEvent:] + 263
12 UIKit 0x000000010fe3a553 _UIApplicationHandleEventQueue + 6660
13 CoreFoundation 0x000000010f53d301 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
14 CoreFoundation 0x000000010f53322c __CFRunLoopDoSources0 + 556
15 CoreFoundation 0x000000010f5326e3 __CFRunLoopRun + 867
16 CoreFoundation 0x000000010f5320f8 CFRunLoopRunSpecific + 488
17 GraphicsServices 0x0000000113cadad2 GSEventRunModal + 161
18 UIKit 0x000000010fe3ff09 UIApplicationMain + 171
19 SuperCool 0x000000010f432422 main + 114
20 libdyld.dylib 0x0000000111e7f92d start + 1
21 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
最佳答案
好像您未正确连接uncoolButton
插座或makeMeNotSoUncoolButton
操作。
关于ios - 无法识别的选择器已发送到实例0x7fc4e9544fc0,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/38109410/