Due to the many screen sizes in the mobile world, staying relative to screen size is crucial. Hard-coding margins and sizes based on points can be short-sighted. In this post, we will subclass NSLayoutConstraint to achieve percentage-based margins.
Redirecting Mobile Users by Screen Size Instead of Device Type
Let’s face it, the web was not designed for phones. For the past decade, developers have been desperately retrofitting the web for a post-mobile world. We need something more fundamental, such as extending the User Agent to include attributes like screen size values. Until then, I would like to present another used approach which is to redirect users by screen size via JavaScript instead of using the User Agent.