How to change splash screen in portable xamarin io

2019-07-21 00:32发布

问题:

I am using portable xamarin form in which one the project is IOS porject

In IOS project I want to create splash screen. I added Iphone Launches images and iPad launched images in ios project property.

when i run the application it show default splash screen.

I also try by removing launchscreen tag from info.plist file, when i run application splash screen is displaying but header and footer become black

Please suggest me how to change the splashscreen of the ios project

Thanks in advance.

回答1:

At first you should know, that the splash screen is just a static image, you can set it by this step:

1 Create a single view application:

2 Going to "info.plist" you can find "launch images", click "Use Asset Catalog":

3 Then remove the "LaunchScreen.storyboard" from your solution, and remove the Key "Launch screen interface file base name" from the info.plist->source:

4 At last set the image you want in "Assets.xcassets":

Oh, another thing, if you need change anything in "Assets.xcassets" you'd batter:

1 Clean your solution and rebuild it;

2 Delete the APP from your device if you already install the old one;

3 Then install the new one, it will works.

Hope it can help you.



回答2:

Add one xib file and setup your launch screen image in that xib file with UIImageview, and then assign that file to"Launch Screen File" Check attached screenshot for help.

Hope this helps!



回答3:

Make sure you are connected to your external Mac. Then double click Launchscreen.storyboard in your iOS-project. You should get a design-view of the Splashscreen.



回答4:

If you want to put a image to fill any screen size without open Xcode:

Go to your Resources -> LaunchScreen.storyboard file

  • Right click to your "LaunchScreen.storyboard" file -> Open Width -> Source Code Editor

Replace your Storyboard code with the following:

<?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>
  • Where you see "background1.png" put the name of your background resource image file that should be located in the Resources Folder of your Xamarin.ios project.