Jonny Huang
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # 解析度修改實現方式 因應四月後Apple官方要求,提交審核的APP必須全面改用LaunchScreen.storyboard的啟動方式,以支援全裝置類型的解析度。然而,支援全裝置解析度後,**高解析的裝置會有字體變小的問題**,有些老舊頁面如果沒有以autolayout或比例計算的方式設計,也**會有寬度高度變小的問題**,如下圖。 ![](https://i.imgur.com/25JHL31.jpg) ![](https://i.imgur.com/B4fDHVm.jpg) 為了解決上述的寬高以及字體大小問題,我們分別取得iPhone,iPad的最小寬度作為基準,比例放大需呈現的頁面與字體,實現過程如下。 已知現有的phone裝置尺寸大小可分為320, 375, 414三種。Pad裝置尺寸大小可分為768(1024,1112)。 我們的實現方式是以320為基準(Pad版以768為基準),計算裝置寬度的放大比率(375為1.17, 414為1.29)。 ![](https://i.imgur.com/8hVyqV7.png) 如下新增兩個全域function UIScaledRate先取得裝置寬度,並除以基準值取得放大比率(裝置寬度/基準值)。 UIScaledSize則是很單純的將傳入的尺寸乘上放大比率,取得最終應該要呈現的寬高。 ``` CGFloat UIScaledRate() { CGFloat width = CGRectGetWidth([[UIScreen mainScreen] bounds])>CGRectGetHeight([[UIScreen mainScreen] bounds]) ? CGRectGetHeight([[UIScreen mainScreen] bounds]) : CGRectGetWidth([[UIScreen mainScreen] bounds]); CGFloat baseWidth = [UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad ? 768 : 320; return (width / baseWidth); } CGFloat UIScaledSize(CGFloat defaultSize) { int scaledSize = (int)floorf(defaultSize * UIScaledRate()); return scaledSize; } ``` 字體放大部分則是擴充UIFont+DynamicType,新增dynamicFontOfSize方法,將原本的fontSize先乘上放大比例後再呼叫原本的systemFontOfSize,這樣就可以達到字級放大的效果。 部分字體是設計在xib底下的,可以直接用[label.font dynamicFont]方式擴充高度。 若連label都沒有關聯的,就得要先拉關聯出來。 ``` + (instancetype)dynamicFontOfSize:(CGFloat)pointSize { return [UIFont systemFontOfSize:MIUIScaledSize(pointSize)]; } + (instancetype)boldDynamicFontOfSize:(CGFloat)pointSize { return [UIFont boldSystemFontOfSize:MIUIScaledSize(pointSize)]; } - (UIFont *)dynamicFont { return [self fontWithSize:MIUIScaledSize(self.pointSize)]; } ``` 以上就是我們實現自適應裝置解析度的作法,最麻煩的點還是在於每個頁面都需要針對寬高及字體進行修改,這是苦工,只能夠一個一個頁面檢查,針對大怪獸的專案,建議可以用Flex工具協助修改,可以幫你省下大量時間。 下面是我在這次修改中負責修改的頁面,可以快速掃過。 # iPhone解析度修改列表 ## 舊版走勢報價 左:原始版(no add storyboard) - 中:修改前(added storyboard) - 右:修改後 ![](https://i.imgur.com/UW3QTs4.jpg) ## 舊版警示設定 ![](https://i.imgur.com/geRSdqp.jpg) ![](https://i.imgur.com/ZkxLENU.jpg) ## 舊版技術線圖 ![](https://i.imgur.com/ClQc20L.jpg) ## 警示中心 ![](https://i.imgur.com/BpkLoeE.jpg) ## 舊版盤後籌碼 ![](https://i.imgur.com/DozhKdJ.jpg) ![](https://i.imgur.com/552tT0D.jpg) ![](https://i.imgur.com/bkIkxaz.jpg) ![](https://i.imgur.com/Aw8AWJF.jpg) ![](https://i.imgur.com/D6uK5j2.jpg) ![](https://i.imgur.com/zgpV81J.jpg) ![](https://i.imgur.com/kyUz5pZ.jpg) ![](https://i.imgur.com/A4564qj.jpg) ![](https://i.imgur.com/sUiXBEJ.jpg) ![](https://i.imgur.com/LFmGC4y.jpg) ![](https://i.imgur.com/hLlDoUJ.png) ![](https://i.imgur.com/pTW7LW1.png) ![](https://i.imgur.com/JSCmkpX.jpg) ![](https://i.imgur.com/cPybUQS.jpg) ![](https://i.imgur.com/0XbXDNb.jpg) ![](https://i.imgur.com/hngadbM.jpg) ![](https://i.imgur.com/MMjaSFJ.jpg) ![](https://i.imgur.com/x6Eakkc.jpg) ![](https://i.imgur.com/TKQZW00.jpg) ![](https://i.imgur.com/v6NtjNf.jpg) ![](https://i.imgur.com/M7yooWN.jpg) ![](https://i.imgur.com/zrFLB34.jpg) ![](https://i.imgur.com/te85S8K.jpg) ![](https://i.imgur.com/VtGw2Lw.jpg) ![](https://i.imgur.com/1q0TM2X.jpg) ![](https://i.imgur.com/hh3jesN.jpg) ![](https://i.imgur.com/HswNElI.jpg) ![](https://i.imgur.com/4FBSoNx.jpg) ![](https://i.imgur.com/kjrnn9G.jpg) ![](https://i.imgur.com/x3aMesp.jpg) ## 自選編輯 ![](https://i.imgur.com/R4QC5es.jpg) ![](https://i.imgur.com/qbavkt4.jpg) ## 自選報價 ![](https://i.imgur.com/Zj6jpUQ.jpg) ![](https://i.imgur.com/SQf7Gcw.jpg) # iPad解析度修改列表 ## 群組功能 ![](https://i.imgur.com/q4c47aD.jpg) ## 自選編輯 ![](https://i.imgur.com/jjW7RFy.jpg) ![](https://i.imgur.com/DVATe1m.jpg) ![](https://i.imgur.com/hLm4ugq.jpg) ## 警示中心 ![](https://i.imgur.com/lEUj5lO.png) ## 類股報價 ![](https://i.imgur.com/7ONiWT5.png) ## 九宮格 ![](https://i.imgur.com/98iLS9M.jpg)

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully