Swift3 - AVAudioPlayer没有声音

没声音需要检查下player是否是定义的全局属性 var audioPlayer:AVAudioPlayer? override func viewDidLoad() { super.viewDidLoad() self.view.backgroundColor = UIColor.white let audioUrl = Bundle.main.url(forResource: "music", withExtension: "mp3")! do{ try audioPlayer = AVAudioPlayer(contentsOf: audioUrl) audioPlayer?.play() audioPlayer?.volume = 0.8 audioPlayer?.delegate = …

Read more

webView - 用系统浏览器打开链接

如果使用的是a标签,可以直接用下面的代码: - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType { NSURL *requestURL =[request URL]; if (([[requestURL scheme] isEqualToString: @"http"] || [[requestURL scheme] isEqualToString:@"https"] || [[requestURL scheme] isEqualToString: @"mailto" ]) && (navigationType == UIWebView…

Read more

typebot.js实现打字效果

想要实现简单的打字效果动画,有typebot.js就够了。 link to github 引用js文件 <script src='typebot.js'></script> 添加一个typebot实例 var rb=new typebot("#bl", 100, 100, ["this is a test"], true, false); 打字效果就出来了,更多参数设置可参考Github。…

Read more

Start a HTTP server in Python and NodeJS

Python: python -m CGIHTTPServer NodeJS: Install the http-server package: npm install http-server -g Then run the server with the following command http-server -p 8000 More details about http-server…

Read more