Ios 两个addTarget:action:forControlEvent:calls的不同结果

Ios 两个addTarget:action:forControlEvent:calls的不同结果,ios,button,target-action,Ios,Button,Target Action,代码只不过是按钮的目标操作: [subButton addTarget:self action:@selector(pickerviewSubButtonClicked:) forControlEvents:UIControlEventTouchUpInside]; //[subButton addTarget:self action:@selector(pickerViewSubButtonClicked:) forControlEvents:UICon

代码只不过是按钮的目标操作:

[subButton addTarget:self
              action:@selector(pickerviewSubButtonClicked:) 
    forControlEvents:UIControlEventTouchUpInside];

//[subButton addTarget:self action:@selector(pickerViewSubButtonClicked:) forControlEvents:UIControlEventTouchUpInside];
我有第一个失败,错误为“…无法识别的选择器发送到实例…”,使用标记的选择器时,将成功。我怀疑是什么原因造成的 通过排版,但不知道确切原因。这是它们的十六进制转储文件:

00000000: 5b73 7562 4275 7474 6f6e 2061 6464 5461  [subButton addTa
00000010: 7267 6574 3a73 656c 660a 0920 2020 6163  rget:self..   ac
00000020: 7469 6f6e 3a40 7365 6c65 6374 6f72 2870  tion:@selector(p
00000030: 6963 6b65 7276 6965 7753 7562 4275 7474  ickerviewSubButt
00000040: 6f6e 436c 6963 6b65 643a 2920 0a09 2020  onClicked:) ..  
00000050: 2066 6f72 436f 6e74 726f 6c45 7665 6e74   forControlEvent
00000060: 733a 5549 436f 6e74 726f 6c45 7665 6e74  s:UIControlEvent
00000070: 546f 7563 6855 7049 6e73 6964 655d 3b0a  TouchUpInside];.
00000080: 2f2f 5b73 7562 4275 7474 6f6e 2061 6464  //[subButton add
00000090: 5461 7267 6574 3a73 656c 6620 6163 7469  Target:self acti
000000a0: 6f6e 3a40 7365 6c65 6374 6f72 2870 6963  on:@selector(pic
000000b0: 6b65 7256 6965 7753 7562 4275 7474 6f6e  kerViewSubButton
000000c0: 436c 6963 6b65 643a 2920 666f 7243 6f6e  Clicked:) forCon
000000d0: 7472 6f6c 4576 656e 7473 3a55 4943 6f6e  trolEvents:UICon
000000e0: 7472 6f6c 4576 656e 7454 6f75 6368 5570  trolEventTouchUp
000000f0: 496e 7369 6465 5d3b 0a                   Inside];.
有什么想法吗?

[子按钮添加目标:自我
[subButton addTarget:self
              action:@selector(pickerviewSubButtonClicked:) 
    forControlEvents:UIControlEventTouchUpInside];

pickerviewSubButtonClicked <-- Error
pickerViewSubButtonClicked <-- Work
操作:@选择器(pickerviewSubButtonClicked:) forControlEvents:UIControlEventTouchUpInside];
pickerviewSubButtonClicked您的操作按钮是否发送事件?
选择器名称后面包含“:”时,也会发送一个对象

您有一个打字错误vv

选择器viewsubbutton已选中


Objective-C是区分大小写的语言

谢谢!就这样!因为后面的部分“…ewSubButtonClicked:”是由XCode自动完成的,所以我相信它,不必仔细检查!它不会纠正任何打字错误吗?