我想設置一個UIImageView的形象等於某個圖像:- [UIRoundedRectButton setImage:]:無法識別的選擇發送到實例
- (IBAction)showCard:(id)sender {
for (KCCardView *cardView in self.view.subviews) {
for (KCCard *aCard in dealerHand) {
cardView.image = aCard.cardImage;
}
}
}
不過這些都不斷髮生的是應用程序崩潰與以下記錄到控制檯。我似乎無法找到錯誤。
-[UIRoundedRectButton setImage:]: unrecognized selector sent to instance
謝謝!
(gdb) backtrace
#0 0x012deccc in objc_exception_throw()
#1 0x01150f0d in -[NSObject doesNotRecognizeSelector:]()
#2 0x010b5e2f in ___forwarding___()
#3 0x010b5c12 in __forwarding_prep_0___()
#4 0x011510e9 in -[NSObject performSelector:withObject:withObject:]()
#5 0x000197fd in -[UIApplication sendAction:to:from:forEvent:]()
#6 0x00019792 in -[UIApplication sendAction:toTarget:fromSender:forEvent:]()
#7 0x000be2aa in -[UIControl sendAction:to:forEvent:]()
#8 0x000be773 in -[UIControl(Internal) _sendActionsForEvents:withEvent:]()
#9 0x000bda3e in -[UIControl touchesEnded:withEvent:]()
#10 0x0003eb04 in -[UIWindow _sendTouchesForEvent:]()
#11 0x0003ed2d in -[UIWindow sendEvent:]()
#12 0x0002550c in -[UIApplication sendEvent:]()
#13 0x00018d00 in _UIApplicationHandleEvent()
#14 0x00deb7fe in PurpleEventCallback()
#15 0x01123435 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__()
#16 0x01087d72 in __CFRunLoopDoSource1()
#17 0x0108665a in __CFRunLoopRun()
#18 0x01085b04 in CFRunLoopRunSpecific()
#19 0x01085a1b in CFRunLoopRunInMode()
#20 0x00de9f67 in GSEventRunModal()
#21 0x00dea02c in GSEventRun()
#22 0x00016cf2 in UIApplicationMain()
#23 0x00001ed8 in main (argc=1, argv=0xbfffed94) at /Users/Alec/Desktop/Blackjack/Blackjack/main.m:16
#24 0x00001e35 in start()
'KCCardView'中定義了'image'如何定義? – jrtc27 2012-02-21 21:50:49
圖片是一個UIImage。 – Alec 2012-02-21 21:58:51
發佈代碼!有些東西是錯誤的,所以我們需要代碼(除非KCCardView是UIImageView子類,在這種情況下不需要)。 – jrtc27 2012-02-21 22:24:49