Hallo alle zusammen,
seit einpaar Stunden beschäftige ich mich mit der iOS Entwicklung.
Meine bisherigen Erfahrungen habe ich in u. a. C++ und C# .NET gesammelt.
Nun stehe ich vor einem Problem, dass ich nicht so recht verstehe.
Ich habe im Storyboard zwei Buttons positioniert und gebunden:
Innerhalb der m-Datei habe ich folgenden Code implementiert:
Dadurch möchte ich testen, ob die Zeiger richtig verglichen werden (isEqual hilft hier auch nicht). Die Buttons werden beim drücken entsprechend deaktiviert. Bei myButton bekomme ich aber einen Fehler, den ich nicht nachvollziehen kann.
Hat jemand eine Idee was das Problem ist?
seit einpaar Stunden beschäftige ich mich mit der iOS Entwicklung.
Meine bisherigen Erfahrungen habe ich in u. a. C++ und C# .NET gesammelt.
Nun stehe ich vor einem Problem, dass ich nicht so recht verstehe.
Ich habe im Storyboard zwei Buttons positioniert und gebunden:
Code:
[COLOR=#000000][FONT=Menlo]-([COLOR=#BB2CA2]IBAction[/COLOR])buttonPressed:([COLOR=#BB2CA2]id[/COLOR])sender;[/FONT][/COLOR]
[COLOR=#BB2CA2][FONT=Menlo]@property[COLOR=#000000] ([/COLOR]weak[COLOR=#000000], [/COLOR]nonatomic[COLOR=#000000]) [/COLOR]IBOutlet[COLOR=#000000] [/COLOR][COLOR=#703DAA]UIButton[/COLOR][COLOR=#000000] *myButton;[/COLOR][/FONT][/COLOR]
[COLOR=#000000][FONT=Helvetica]@property (weak, nonatomic) IBOutlet UIButton *myButton2;[/FONT][/COLOR]
Innerhalb der m-Datei habe ich folgenden Code implementiert:
Code:
[COLOR=#BB2CA2][FONT=Menlo]@synthesize[COLOR=#000000] myButton;[/COLOR][/FONT][/COLOR]
[COLOR=#000000][FONT=Helvetica]@synthesize myButton2;[/FONT][/COLOR]
[COLOR=#000000][FONT=Menlo]-([COLOR=#BB2CA2]IBAction[/COLOR])buttonPressed:([COLOR=#BB2CA2]id[/COLOR])sender[/FONT][/COLOR]
[COLOR=#000000][FONT=Menlo]{[/FONT][/COLOR]
[COLOR=#000000][FONT=Menlo] [COLOR=#BB2CA2]if[/COLOR]([COLOR=#4F8187]myButton[/COLOR] == sender)[/FONT][/COLOR]
[COLOR=#000000][FONT=Menlo] {[/FONT][/COLOR]
[COLOR=#000000][FONT=Menlo] [[COLOR=#4F8187]myButton[/COLOR] [COLOR=#3D1D81]setEnabled[/COLOR]:[COLOR=#BB2CA2]NO[/COLOR]];[/FONT][/COLOR]
[COLOR=#000000][FONT=Menlo] }[/FONT][/COLOR]
[COLOR=#000000][FONT=Menlo] [/FONT][/COLOR]
[COLOR=#000000][FONT=Menlo] [COLOR=#BB2CA2]if[/COLOR]([COLOR=#4F8187]myButton2[/COLOR] == sender)[/FONT][/COLOR]
[COLOR=#000000][FONT=Menlo] {[/FONT][/COLOR]
[COLOR=#000000][FONT=Menlo] [[COLOR=#4F8187]myButton2[/COLOR] [COLOR=#3D1D81]setEnabled[/COLOR]:[COLOR=#BB2CA2]NO[/COLOR]];[/FONT][/COLOR]
[COLOR=#000000][FONT=Menlo] }[/FONT][/COLOR]
[COLOR=#000000][FONT=Menlo]}[/FONT][/COLOR]
Dadurch möchte ich testen, ob die Zeiger richtig verglichen werden (isEqual hilft hier auch nicht). Die Buttons werden beim drücken entsprechend deaktiviert. Bei myButton bekomme ich aber einen Fehler, den ich nicht nachvollziehen kann.
Code:
[COLOR=#000000][FONT=Menlo][B]2014-01-28 12:21:20.906 testapp[759:60b] -[testappDetailViewController buttonPressed]: unrecognized selector sent to instance 0x1655e2e0[/B][/FONT][/COLOR]
[COLOR=#000000][FONT=Menlo][B]2014-01-28 12:21:20.912 testapp[759:60b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[testappDetailViewController buttonPressed]: unrecognized selector sent to instance 0x1655e2e0'[/B][/FONT][/COLOR]
[COLOR=#000000][FONT=Menlo][B]*** First throw call stack:[/B][/FONT][/COLOR]
[COLOR=#000000][FONT=Menlo][B](0x2e92af4b 0x38ffc6af 0x2e92e8e7 0x2e92d1cb 0x2e87c4d8 0x310d2713 0x310d26b3 0x310d2691 0x310be11f 0x310d2107 0x310d1dd9 0x310cce65 0x310a279d 0x310a0fa3 0x2e8f6183 0x2e8f5653 0x2e8f3e47 0x2e85ec27 0x2e85ea0b 0x33532283 0x31102049 0x28efd 0x39504ab7)[/B][/FONT][/COLOR]
[COLOR=#000000][FONT=Menlo][B]libc++abi.dylib: terminating with uncaught exception of type NSException[/B][/FONT][/COLOR]
Hat jemand eine Idee was das Problem ist?