首页 > 解决方案 > 有没有办法在 iOS 启动屏幕上添加一些动画或任何类型的移动效果?

问题描述

我正在使用这个启动屏幕代码:

<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="15702" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
    <device id="retina4_7" orientation="portrait" appearance="light"/>
    <dependencies>
        <deployment identifier="iOS"/>
        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15704"/>
        <capability name="Safe area layout guides" minToolsVersion="9.0"/>
        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
    </dependencies>
    <scenes>
        <!--View Controller-->
        <scene sceneID="EHf-IW-A2E">
            <objects>
                <viewController id="01J-lp-oVM" sceneMemberID="viewController">
                    <view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
                        <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                        <subviews>
                            <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Test" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="EcF-nC-k2o">
                                <rect key="frame" x="137.5" y="309.5" width="100" height="48"/>
                                <fontDescription key="fontDescription" type="system" pointSize="40"/>
                                <color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                                <nil key="highlightedColor"/>
                            </label>
                        </subviews>
                        <color key="backgroundColor" red="0.60084011130136983" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                        <constraints>
                            <constraint firstItem="EcF-nC-k2o" firstAttribute="centerX" secondItem="wza-7a-P1J" secondAttribute="centerX" id="4jn-PU-7OP"/>
                            <constraint firstItem="EcF-nC-k2o" firstAttribute="centerY" secondItem="wza-7a-P1J" secondAttribute="centerY" id="hft-du-2Xv"/>
                        </constraints>
                        <viewLayoutGuide key="safeArea" id="wza-7a-P1J"/>
                    </view>
                </viewController>
                <placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
            </objects>
            <point key="canvasLocation" x="53" y="375"/>
        </scene>
    </scenes>
</document>

我想做的是添加一些动画,例如一些移动的点或任何东西来显示这个屏幕的一些运动。

有没有办法做到这一点?

寻找人们有使用经验的任何建议。

标签: xamarinxamarin.ios

解决方案


不幸的是,这是不可能的。

来自 Apple 文档

启动屏幕会在您的应用程序启动时立即出现,并很快被应用程序的第一个屏幕取代,给人的印象是您的应用程序快速且响应迅速。启动屏幕不是艺术表达的机会。

这意味着我们作为开发人员将无法在此屏幕上添加任何动画。

虽然,有一个“解决方法”。也就是说,创建一个相同的屏幕,这将是您的应用在启动画面消失后导航到的屏幕。在此屏幕中,您将能够执行您想要的所有动画,一旦您的动画完成,您可以通过导航到应用程序的其他部分来结束。

希望这可以帮助。-


推荐阅读