Wei's Diary of Programming

How to simulate GPS location without jailbreaking on iPhone?

Prepare for simulating GPS Download this repository from Github. Get the coordinates of the place you want to go. In this example, I want to simulate Reykjavik Airport in Iceland, which is 64....

A Standard Placeholder for Lorem Ipsum

What is Lorem ipsum? A common form of lorem ipsum reads below with words altered, added, and removed to make it nonsensical, improper Latin. Lorem ipsum dolor sit amet, consectetur adipiscing e...

How to implement highlight in Jekyll 3.0?

Why do we need change? On February 2, 2016, Github posted an article about an update in Github Page. Basically, it will run Jekyll 3.0 in Github Page, and the major impact are below: GitHub Page...

How to solve CORS issue in XMLHttpRequest by using Node.js?

Question I am trying to do API request by using RESTful API, however, I got error message below from console. XMLHttpRequest cannot load http://example.com/abcd. Response to preflight request d...

How to mix UIKit and TVMLKit within one app?

Question I’m exploring tvOS and I found that Apple offers nice set of templates written using TVML. I’d like to know if a tvOS app that utilises TVML templates can also use UIKit. Can I mix UIKit ...

How to dismiss ViewController in Swift?

Question I am trying to dismiss a ViewController in swift by calling dismissViewController in an IBAction. @IBAction func cancel(sender: AnyObject) { self.dismissViewControllerAnimated(false, c...

Set Initial Viewcontroller In Appdelegate

Question I would like to set the initial viewcontroller from the appdelegate by using Swift. Answer Swift 2 func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions...

Instantiate and Present a viewController in Swift

Question How to instantiate and then presenting a viewController from a specific storyboard? Answer Swift 3 let storyboard = UIStoryboard(name: "MyStoryboardName", bundle: nil) let controller = st...

iOS App生命周期初识

面对每次打开 iOS 应用时。都是否想到过其 App 运行过程:从启动到按 Home 键回到主屏幕,从运行中到按两下 Home 键进入任务管理界面,甚至 iOS9 后支持多任务的 iPad 当两个 App 出现在同一屏幕上,这几个情况 App 所处于什么状态,其过渡中又在进行怎样的状态切换呢? App状态变化的历史 在 iOS4 之前的 App 时代,整个界面只允许一个 App ...

2017 年的年度挑战

[English Version] 2016 年的简单回顾 2016 年完成了如下几个 milestones,总体来说是比较满意的一年。对于工作和学习,自己觉得有使不完的劲。 顺利毕业,结束自己的研究生生涯。 找到一份不错的实习,并顺利拿到全职职位。 掌握了一门新语言 Swift,并开发了一款 tvOS 的 App。 2017 年的几个决心 学习两个前段框...