qdwang
V2EX  ›  Swift

请教一个关于 Swift 的基础小问题

  •  
  •   qdwang · Aug 30, 2024 · 5677 views
    This topic created in 796 days ago, the information mentioned may be changed or developed.

    在锁屏幕方向的情况下,如何获取设备的方向呢?

    我试了网上各种方法都不行,用了官方文档说可以的UIDevice.current.orientation,也不行。。。

    1 replies  •  2024-09-25 14:51:40 +08:00
    chipmuck
    chipmuck
    Sep 25, 2024
    1
    试试看换一种思路:

    将屏幕方向解锁,然后通过代码控制的方式来限定某些 View 的 orientation
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   3957 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 81ms · UTC 01:02 · PVG 09:02 · LAX 17:02 · JFK 20:02
    ♥ Do have faith in what you're doing.