Swift 3
Это можно сделать безопасным способом, представив контроллер всплеска, что бы вы ни указали, затем удалите его и покажите свой обычный rootViewController.
В AppDelegate вы можете создать эти 2 метода:
private func extendSplashScreenPresentation(){
// Get a refernce to LaunchScreen.storyboard
let launchStoryBoard = UIStoryboard.init(name: "LaunchScreen", bundle: nil)
// Get the splash screen controller
let splashController = launchStoryBoard.instantiateViewController(withIdentifier: "splashController")
// Assign it to rootViewController
self.window?.rootViewController = splashController
self.window?.makeKeyAndVisible()
// Setup a timer to remove it after n seconds
Timer.scheduledTimer(timeInterval: 5, target: self, selector: #selector(dismissSplashController), userInfo: nil, repeats: false)
}
2.
@objc private func dismissSplashController() {
// Get a refernce to Main.storyboard
let mainStoryBoard = UIStoryboard.init(name: "Main", bundle: nil)
// Get initial viewController
let initController = mainStoryBoard.instantiateViewController(withIdentifier: "initController")
// Assign it to rootViewController
self.window?.rootViewController = initController
self.window?.makeKeyAndVisible()
}
Теперь вы вызываете
self.extendSplashScreenPresentation()
в файле doneFinishLaunchingWithOptions.
У вас установлено значение go ...
В конце я нашел, что следующее работало. Данный...
<Popup x:Name="_popup"
StaysOpen="False"
PopupAnimation="Slide"
AllowsTransparency="True">
... Я использовал этот код в конструкторе после вызова InitializeComponent
...
// Ensure that any mouse event that gets through to the
// popup is considered handled, otherwise the popup would close
_popup.MouseDown += (s, e) => e.Handled = true;
Это действительно кажется нечетным, что это проигнорировало бы Focusable на Всплывающем окне и Границе. Я смог решить Вашу проблему путем изменения StaysOpen в триггере, когда мышь по Границе:
<Grid xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ToggleButton x:Name="btnPop" Content="Pop!" Width="100" Height="50"/>
<Popup Placement="Bottom" PlacementTarget="{Binding ElementName=btnPop}" IsOpen="{Binding IsChecked, ElementName=btnPop}">
<Popup.Style>
<Style TargetType="{x:Type Popup}">
<Setter Property="StaysOpen" Value="False"/>
<Style.Triggers>
<DataTrigger Binding="{Binding IsMouseOver, ElementName=brd}" Value="True">
<Setter Property="StaysOpen" Value="True"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Popup.Style>
<Border x:Name="brd" Background="White" BorderThickness="1" BorderBrush="Black">
<StackPanel>
<TextBox Margin="10"/>
<TextBlock Text="Some text is here." Margin="10"/>
<TextBox Margin="10"/>
</StackPanel>
</Border>
</Popup>
</Grid>
Мое лучшее предположение - Вы, имеют некоторое продолжение проблем прозрачности. Попытайтесь установить фоновую кисть на всплывающем окне.
Разве ваше всплывающее окно не вложено в ToggleButton или другие кнопки? Тогда было бы логично остановить перенаправленное событие на уровне Popup.