【问题标题】:How to change splash screen in portable xamarin ios project?如何更改便携式 xamarin ios 项目中的启动画面?
【发布时间】:2016-09-28 11:11:04
【问题描述】:

我正在使用可移植的 xamarin 表单,其中一个项目是 IOS 项目

在 IOS 项目中,我想创建启动画面。我在 ios 项目属性中添加了 Iphone Launches 图像和 iPad 启动图像。

当我运行应用程序时,它会显示默认启动屏幕。

我还尝试从 info.plist 文件中删除启动屏幕标签,当我运行应用程序启动屏幕时显示但页眉和页脚变黑

请建议我如何更改 ios 项目的启动画面

提前致谢。

【问题讨论】:

  • 面临同样的问题,但没有找到任何解决方案。到目前为止运气好吗?

标签: ios xamarin.ios splash-screen


【解决方案1】:

首先你应该知道,闪屏只是一个静态图片,你可以通过这一步来设置:

1 创建单视图应用程序:

2 进入“info.plist”可以找到“launch images”,点击“Use Asset Catalog”:

3 然后从您的解决方案中删除“LaunchScreen.storyboard”,并从 info.plist->source 中删除键“启动屏幕界面文件基本名称”:

4 最后在“Assets.xcassets”中设置你想要的图像:

哦,另外一件事,如果您需要更改“Assets.xcassets”中的任何内容,您会打:

1 清理您的解决方案并重建它;

2如果您已经安装了旧的APP,请从您的设备中删除该APP;

3 然后安装新的,就可以了。

希望对你有帮助。

【讨论】:

    【解决方案2】:

    添加一个 xib 文件并使用 UIImageview 在该 xib 文件中设置启动屏幕图像,然后将该文件分配给“启动屏幕文件” 查看随附的屏幕截图以获取帮助。

    希望这会有所帮助!

    【讨论】:

    • 这是在 XCode 中为 Native 开发设置启动图像的方法,而不是 Xamarin.iOS。
    • 要创建构建或提交应用到应用商店,您只使用 xcode,对吧?
    • 不,如果您使用 Xamarin.iOS,则根本不需要打开 XCode,只需使用 Xamarin Studio 归档并提交即可。
    • 第 2 步 - 我没有使用资产目录的选项 - 现在怎么办?
    【解决方案3】:

    如果你想在不打开 Xcode 的情况下将图像填满任何屏幕尺寸:

    转到您的资源 -> LaunchScreen.storyboard 文件

    • 右键单击“LaunchScreen.storyboard”文件 -> 打开宽度 -> 源代码编辑器

    将您的 Storyboard 代码替换为以下内容:

    <?xml version="1.0" encoding="UTF-8"?>
    <document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14109" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="X5k-f2-b5h">
        <device id="retina4_7" orientation="portrait">
            <adaptation id="fullscreen"/>
        </device>
        <dependencies>
            <deployment identifier="iOS"/>
            <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
            <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
        </dependencies>
        <scenes>
            <!--View Controller-->
            <scene sceneID="gAE-YM-kbH">
                <objects>
                    <viewController id="X5k-f2-b5h" sceneMemberID="viewController">
                        <layoutGuides>
                            <viewControllerLayoutGuide type="top" id="Y8P-hJ-Z43"/>
                            <viewControllerLayoutGuide type="bottom" id="9ZL-r4-8FZ"/>
                        </layoutGuides>
                        <view key="view" contentMode="scaleToFill" id="yd7-JS-zBw">
                            <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
                            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                            <subviews>
                                <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" image="background1.png" translatesAutoresizingMaskIntoConstraints="NO" id="7Bm-if-fjC">
                                    <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
                                    <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                </imageView>
                            </subviews>
                            <color key="backgroundColor" red="0.20392156862745098" green="0.59607843137254901" blue="0.85882352941176465" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                        </view>
                    </viewController>
                    <placeholder placeholderIdentifier="IBFirstResponder" id="XAI-xm-WK6" userLabel="First Responder" sceneMemberID="firstResponder"/>
                </objects>
                <point key="canvasLocation" x="348" y="338.68065967016497"/>
            </scene>
        </scenes>
        <resources>
            <image name="background1.png" width="2560" height="1600"/>
        </resources>
    </document>
    
    • 在您看到“background1.png”的位置放置背景资源图像文件的名称,该文件应位于 Xamarin.ios 项目的资源文件夹中。

    【讨论】:

      【解决方案4】:

      确保您已连接到外部 Mac。然后在你的 iOS 项目中双击 Launchscreen.storyboard。您应该获得 Splashscreen 的设计视图。

      【讨论】:

        猜你喜欢
        • 2020-08-02
        • 2017-01-14
        • 2017-01-05
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多