我得到了一些指向某些 mp3 的 URL,例如:
(1) localhost://blablabla/song1.mp3
(2) localhost://blablabla/songwithmorechars.mp3
等等。
如何将 URL 裁剪为:
(1) song1.mp3
(2) songwithmorechars.mp3
需要显示我AVAudioPlayer
正在播放的当前歌曲UILabel
。
谢谢
解决方案:
这是交易:
titleLabel.text = [[[self.audioPlayer.url absoluteString] lastPathComponent] stringByReplacingOccurrencesOfString:@".mp3" withString:@""];