ios - Change setTitle to setImage -
i'm new developing excuse me if or ask doesn't make sense @ all. working on project in want play audio files mp3. allready made play pause button. got work music plays , when press on button "pause" text changes "play". want make playpause button image instead of plain text. "old" line of code:
- (ibaction)playorpause:(id)sender { if(self.myaudioplayer.playing == yes) { [self.myaudioplayer pause]; [self.playpausebutton settitle:@"play" forstate:uicontrolstatenormal];
i tried changing last line setimage:
[self.playpausebutton setimage:@"playicon.png" forstate:uicontrolstatenormal];
but doesn't seem work immediately.
thanks
you need use uiimage
instance. try:
[self.playpausebutton setimage:[uiimage imagenamed:@"play"] forstate:uicontrolstatenormal];
where @"play"
name of image. (do not forget add images in project.)
Comments
Post a Comment