I'm a objective-C newbie trying to wring the last few compiler warnings out of my code. I've got one case that's got me stumped, and the mighty google does not seem to be able to help me.
I've got a button class that's subclassed from UIButton. (I've since learned that's problematic, and I should have created a whole new class. But I'd like to avoid rewriting this piece if I can.) Anyway, inside my class I'm doing things like calling setTitle:forState:, which generates the following compiler warning:
warning: 'UIButton' may not respond to '+setTitle:forState:'
I've changed my code to invoke this message on self, self cast to UIButton *, and super -- but I always get this warning. The code runs fine. I'm also perplexed about why the compiler thinks setTitle:forState: is a class method; of course it is an instance method.
I'm a objective-C newbie trying to wring the last few compiler warnings out of my code. I've got one case that's got me stumped, and the mighty google does not seem to be able to help me.
I've got a button class that's subclassed from UIButton. (I've since learned that's problematic, and I should have created a whole new class. But I'd like to avoid rewriting this piece if I can.) Anyway, inside my class I'm doing things like calling setTitle:forState:, which generates the following compiler warning:
warning: 'UIButton' may not respond to '+setTitle:forState:'
I've changed my code to invoke this message on self, self cast to UIButton *, and super -- but I always get this warning. The code runs fine. I'm also perplexed about why the compiler thinks setTitle:forState: is a class method; of course it is an instance method.
The setFrame generates this compiler warning:
warning: 'MySubclassedButton' may not respond to '+setFrame:'
I get similar warnings for setTitleEdgeInsets and setTitle. If I cast to a UIButton object, I get this instead:
warning: 'UIButton' may not respond to '+setFrame:'
The setFrame generates this compiler warning:
warning: 'MySubclassedButton' may not respond to '+setFrame:'
I get similar warnings for setTitleEdgeInsets and setTitle. If I cast to a UIButton object, I get this instead:
warning: 'UIButton' may not respond to '+setFrame:'
I'm using version 3.1.4 of Xcode and I'm compiling for a 3.0 device target.
Thanks in advance for any light you can shed on this headscratcher.
Polly
well, i just did a very basic test on changing it, i made and IBAction and i made and IBOUtlet named theButton. heres what i tried first and it worked fine by using th eoutlet i created.
my advice, just make and out of the UIButton, adn connect it to the button, its pretty simple , very basic. Is there something you're trying to do where you cant use and IBOutlet???