适用于 iOS 的 Xamarin 表单:启动画面显示蓝色边框
Posted
技术标签:
【中文标题】适用于 iOS 的 Xamarin 表单:启动画面显示蓝色边框【英文标题】:Xamarin Forms for iOS: Splash Screen shows blue border 【发布时间】:2015-05-26 23:27:44 【问题描述】:我有一个 ios 启动画面,它周围一直显示蓝色边框。我被告知它与具有 LaunchStoryboard 值 (https://forums.xamarin.com/discussion/34081/splash-screen-on-an-xamarin-forms-app-ios) 的 info.plist 有关,但我的 info.plist 上没有这样的键。有什么想法吗?
这是我的 info.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>UIDeviceFamily</key>
<array>
<integer>1</integer>
<integer>2</integer>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
</array>
<key>MinimumOSVersion</key>
<string>8.0</string>
<key>CFBundleDisplayName</key>
<string>MDLDemo</string>
<key>CFBundleIdentifier</key>
<string>com.demo.mdl.hcm</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>CFBundleIconFiles</key>
<array>
<string>icon-60@2x.png</string>
</array>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>CFBundleShortVersionString</key>
<string>0.0.1</string>
<key>UIPrerenderedIcon</key>
<false/>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
</dict>
</plist>
这是我的 LaunchScreen.storyboard 文件
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6245" systemVersion="13F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="X5k-f2-b5h">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6238"/>
</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" />
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" misplaced="YES" image="Default-568h.png" translatesAutoresizingMaskIntoConstraints="NO" id="23">
<rect key="frame" x="0.0" y="0.0" />
<rect key="contentStretch" x="0.0" y="0.0" />
<variation key="heightClass=regular-widthClass=compact" misplaced="YES">
<rect key="frame" x="-8" y="-79" />
</variation>
<variation key="widthClass=compact" misplaced="YES">
<rect key="frame" x="-100" y="0.0" />
</variation>
<variation key="widthClass=regular" misplaced="YES">
<rect key="frame" x="-123" y="-4" />
</variation>
</imageView>
</subviews>
<color key="backgroundColor" red="0.20392156862745098" green="0.59607843137254901" blue="0.85882352941176465" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstItem="23" firstAttribute="centerY" secondItem="yd7-JS-zBw" secondAttribute="centerY" priority="1" id="39"/>
<constraint firstItem="23" firstAttribute="centerX" secondItem="yd7-JS-zBw" secondAttribute="centerX" priority="1" id="41"/>
</constraints>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="XAI-xm-WK6" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="349" y="339"/>
</scene>
</scenes>
<resources>
<image name="Icon-60.png" />
<image name="Default-568h.png" />
<image name="Default-Portrait.png" />
<image name="Default.png" />
<image name="Icon-Small-40.png" />
<image name="Icon-Small.png" />
<image name="Untitled 320 480.png" />
<image name="Untitled 640 1136.png" />
<image name="background.png" />
<image name="background_bottom.png" />
<image name="background_top.png" />
<image name="email.png" />
<image name="FirstTimeCheckIn.png" />
<image name="forgot_password.png" />
<image name="icon-60.png" />
<image name="icon 320 480.png" />
<image name="icon 640 1136.png" />
<image name="icon 640 960.png" />
<image name="menu.png" />
<image name="password.png" />
<image name="Register.png" />
<image name="remember_me.png" />
<image name="Assets/FirstTimeCheckIn.png" />
<image name="Assets/search.png" />
<image name="Assets/greenMessage.png" />
<image name="Assets/orangeMessage.png" />
<image name="Assets/redMessage.png" />
<image name="Assets/settings.png" />
<image name="Assets/search2.png" />
<image name="Assets/icons_white/add.png" />
<image name="Assets/icons_white/camera.png" />
<image name="Assets/icons_white/clipboard.png" />
<image name="Assets/icons_white/confirm.png" />
<image name="Assets/icons_white/email.png" />
<image name="Assets/icons_white/enter_password.png" />
<image name="Assets/icons_white/left_arrow.png" />
<image name="Assets/icons_white/menu.png" />
<image name="Assets/icons_white/message.png" />
<image name="Assets/icons_white/microphone.png" />
<image name="Assets/icons_white/no.png" />
<image name="Assets/icons_white/patiente_id.png" />
<image name="Assets/icons_white/phone_number.png" />
<image name="Assets/icons_white/right_arrow.png" />
<image name="Assets/icons_white/search.png" />
<image name="Assets/icons_white/settings.png" />
<image name="Assets/icons_white/trash.png" />
<image name="Assets/icons_white/username.png" />
<image name="Assets/icons_white/write_msg.png" />
<image name="Assets/icons_white/write_name.png" />
<image name="Assets/icons_white/yes.png" />
<image name="Assets/icons_blue/add.png" />
<image name="Assets/icons_blue/camera.png" />
<image name="Assets/icons_blue/clipboard.png" />
<image name="Assets/icons_blue/confirm.png" />
<image name="Assets/icons_blue/email.png" />
<image name="Assets/icons_blue/enter_password.png" />
<image name="Assets/icons_blue/left_arrow.png" />
<image name="Assets/icons_blue/menu.png" />
<image name="Assets/icons_blue/message.png" />
<image name="Assets/icons_blue/microphone.png" />
<image name="Assets/icons_blue/no.png" />
<image name="Assets/icons_blue/patiente_id.png" />
<image name="Assets/icons_blue/phone_number.png" />
<image name="Assets/icons_blue/right_arrow.png" />
<image name="Assets/icons_blue/search.png" />
<image name="Assets/icons_blue/settings.png" />
<image name="Assets/icons_blue/trash.png" />
<image name="Assets/icons_blue/username.png" />
<image name="Assets/icons_blue/write_msg.png" />
<image name="Assets/icons_blue/write_name.png" />
<image name="Assets/icons_blue/yes.png" />
<image name="Assets/icons_white/white_arrow.png" />
<image name="Assets/icons_white/white_arrow2.png" />
<image name="Assets/icons_white/white_balloon.png" />
<image name="Assets/icons_blue/blue_arrow.png" />
<image name="Assets/icons_blue/blue_arrow2.png" />
<image name="Assets/icons_blue/blue_balloon.png" />
<image name="Assets/white_balloon-03.png" />
<image name="Assets/blue_ballon-03.png" />
<image name="Assets/girl60x60.png" />
<image name="Assets/boy60x60.png" />
<image name="Assets/boy40x40.png" />
<image name="Assets/girl40x40.png" />
<image name="Assets/logo_transp60x60.png" />
<image name="Assets/logo_transp240x240.png" />
<image name="Assets/logo240x240.png" />
<image name="Assets/logo60x60.png" />
<image name="Assets/yes88x88.png" />
<image name="Assets/no88x88.png" />
<image name="Assets/splash_texture.png" />
<image name="Assets/bg.png" />
<image name="Assets/back_arrow.png" />
<image name="Assets/background.png" />
<image name="Assets/menu.png" />
<image name="Assets/email.png" />
<image name="Assets/forgot_password.png" />
<image name="Assets/password.png" />
<image name="Assets/remember_me.png" />
<image name="Assets/Register.png" />
<image name="Assets/persona.png" />
<image name="Assets/personb.png" />
<image name="Assets/avatar-man.png" />
<image name="Assets/icon-plus.png" />
<image name="Assets/messaging-send.png" />
<image name="Assets/messsaging-camera.png" />
<image name="splashscreen-small.png" />
<image name="Default-667h.png" />
</resources>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
<simulatedScreenMetrics key="destination" type="retina47"/>
</simulatedMetricsContainer>
</document>
【问题讨论】:
Resources 文件夹中有一个 LaunchScreen.storyboard,您可以使用 Xcode 打开它并根据需要对其进行自定义。 【参考方案1】:我修好了。我最终使用了故事板教程 (https://developer.xamarin.com/guides/ios/application_fundamentals/working_with_images/launch-screens/#storyboard) 上的 Xamarin.iOS 启动屏幕教程,并按照屏幕上的所有说明进行操作。但是,当我到达:
滚动到编辑器的 Universal Launch Images 部分,打开 Launch Screen 下拉菜单并选择您想要的情节提要的名称 刚刚在上面创建:
我的自定义故事板没有出现在“启动屏幕”下拉菜单中。我最终选择了默认源(我的解决方案上的“LaunchImage”)并在启动屏幕上手动输入了我的故事板的文件名(没有 .storyboard 扩展名)。之后一切正常。
【讨论】:
以上是关于适用于 iOS 的 Xamarin 表单:启动画面显示蓝色边框的主要内容,如果未能解决你的问题,请参考以下文章
如何使用适用于 Android 和 iOS 的 Xamarin 表单在特定频道上的 youtube 上上传视频?
无法在Visual Studio中的Storyboard编辑器中添加图像,以便为Xamarin.iOS创建启动画面