Mobile Development 14 min read

Mastering iOS Responsive Layout: Youku’s Universal Design in Action

This article explains how Youku’s iOS app achieves a single‑code responsive layout that adapts to iPhone, iPad portrait, iPad landscape, floating window, and split‑screen modes by using a custom SDK for state management, layout rules, and data processing, dramatically reducing development and maintenance effort.

Alibaba Cloud Developer
Alibaba Cloud Developer
Alibaba Cloud Developer
Mastering iOS Responsive Layout: Youku’s Universal Design in Action

iOS Layout Size Research

iOS devices have five main size types: iPhone, iPad portrait, iPad landscape, iPad floating window, and iPad split‑screen. Apps are usually built for iPhone and must adapt to the four iPad modes.

Device

Floating Window

Split Screen

iPad mini 2

iPad mini 3

iPad mini 4

iPad Air

iPad Air 2

iPad Pro

Youku iOS Responsive Solution

Responsive layout relies on a unified set of adaptation rules that re‑layout when screen size changes. Most apps only target iPhone; to support more devices we need to obtain and update responsive state, calculate layout parameters (columns, widths), and handle data for complex components.

We built a Responsive Layout SDK that manages state, layout logic, and data mapping.

Responsive SDK position
Responsive SDK position

Responsive App Configuration

The app must be built as a universal binary and configure a LaunchScreen.storyboard (image‑based launch screens are unsuitable for many sizes). In Info.plist it must support all orientations, avoid the "Requires full screen" flag, and use the system UIWindow for split‑screen.

Info.plist orientation settings
Info.plist orientation settings

After enabling floating window and split‑screen, the system no longer calls orientation‑locking code.

Deprecated orientation code
Deprecated orientation code

Responsive SDK

State Management

The SDK provides flags for whether responsive mode is on, the layout size type, and the screen type. It updates state on size changes and notifies via system and custom notifications.

typedef NS_ENUM(NSInteger, YKRLLayoutStyle) {
    YKRLLayoutStyleNormal = 0, // responsive off
    YKRLLayoutStyleResponsive = 1, // responsive on
};

typedef NS_ENUM(NSInteger, YKRLLayoutSizeType) {
    YKRLLayoutSizeTypeS = 0, // phone‑pad floating
    YKRLLayoutSizeTypeL = 1, // pad
    YKRLLayoutSizeTypeXL = 2, // reserved
};

typedef NS_OPTIONS(NSUInteger, YKRLLayoutScreenType) {
    YKRLLayoutScreenTypeUnknown = (1 << 0),
    YKRLLayoutScreenTypePortrait = (1 << 1),
    YKRLLayoutScreenTypeLandscapeLeft = (1 << 2),
    // … other screen types
};

Layout Rules

Rules include column adaptation and width adaptation. Column count is computed from the current screen width, a standard width (440 dp), and a scale factor (1.2).

Responsive columns = (Current width ÷ (Standard width ÷ Standard columns × scale))

Width adaptation uses the adapted column count.

Responsive width = (Current width – margin) ÷ Adapted columns
Feed columns change with width
Feed columns change with width
Component width change
Component width change

Data Processing

Data mapping, filtering, merging, and padding ensure consistent handling on both sides. Components that cannot be scaled proportionally (e.g., full‑width video reservation cards) are mapped to simpler versions.

Component mapping example
Component mapping example

Implementation Flow

The SDK processes data after API responses, provides layout parameters, monitors size changes, and triggers re‑layout.

Business flow diagram
Business flow diagram

Deployment

Integrating the SDK requires converting absolute layouts to relative ones, configuring the hierarchy Window → ViewController → Container → Component, and using AutoLayout, Masonry, or manual frame calculations as needed.

Integration diagram
Integration diagram

Results

By August, Youku’s universal version supports iPhone, iPad portrait, iPad landscape, floating window, and split‑screen with a single codebase, delivering a richer user experience.

Universal version home page
Universal version home page
Universal version playback page
Universal version playback page

Conclusion

Responsive capability is the first step toward multi‑device deployment; it raises expectations for performance and stability and prepares apps for future devices such as foldable screens.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

iOSResponsive DesignYoukuadaptive UIlayout SDK
Alibaba Cloud Developer
Written by

Alibaba Cloud Developer

Alibaba's official tech channel, featuring all of its technology innovations.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.