【发布时间】:2025-12-17 05:40:01
【问题描述】:
我得到了一些指向某些 mp3 的 URL 标题,例如:
(1) localhost://blablabla/song1.mp3
(2) localhost://blablabla/songwithmorechars.mp3
等等。
如何将 URL 裁剪为:
(1) song1.mp3
(2) songwithmorechars.mp3
需要在UILabel 中显示我的AVAudioPlayer 正在播放的当前歌曲。
谢谢
解决方案:
这是交易:
titleLabel.text = [[[self.audioPlayer.url absoluteString] lastPathComponent] stringByReplacingOccurrencesOfString:@".mp3" withString:@""];
【问题讨论】:
标签: iphone xcode nsstring nsurl crop