Is that possible to implement the native transition or animation (opacity etc) in alert controller like what we are doing in Modal dialog?
For modal dialog we can use like below code.
let modal = this.modalCtrl.create(SingleButtonAlertModalPage, { showBackdrop: false,
enableBackdropDismiss: false,
enterAnimation: 'modal-scale-up-enter'});
I want to implement fade in/out in alert controller. While alert dialog displaying it has to come from top of the screen? Is that possible ?
You can apply custom styles to ModalController by adding cssClass.
{ cssClass: 'native-transition' }
In your component.scss file, apply the properties to class for animation.
.native-transition{
opacity: 0.5;
}
Related
I have Bottom sheet I want to show it above TabBar so user tab on button inside List and it show options as Bottom sheet view
1st. I used SwiftUIX with OverlayWindow
like this
.windowOverlay(isKeyAndVisible: self.$optionsShown, {
GeometryReader { _ in
BottomSheetView(
isOpen: $optionsShown
) {
if optionsShown {
OptionsView()
}
}
.edgesIgnoringSafeArea(.all)
}
})
it working but without animation !
2nd. Then I read this Post
I tried it, it working fine with animation if I create Window inside SceneDelegate
but If I create Window outside SceneDelegate it will work without animation like SwiftUIX
Inside SceneDelegate :
Demo Project
Outside SceneDelegate :
Demo Project
I need to create new window inside my view because I will need to pass some values, and I used bottom sheet on multiple view with different views
but I cannot figure out why the animation won't work outside SceneDelegate
Im building an app in swift for macOS, and I have a button on my initial view controller that I want to display a different view controller. I ctrl dragged from that button to the new view controller, and all of the segue options display the new view controller as a new window, rather that replacing the initial view. How can I make this button transition view controllers similar to how it works in iOS apps?
You can first make your segue to the 2nd view controller and then create an IBAction from your button where you call
self.dismiss(animated: true, completion: {})
within it. By doing this your initial view controller will no longer exist.
More detailed:
Segue from your button to the second view controller (ctrl drag)
Make an IBAction by ctrl drag from your button to the view controllers code
Put this into your IBAction:
self.dismiss(animated: true, completion: {})
Now it should look something like this:
#IBAction func dismissView(_ sender: Any) {
self.dismiss(animated: true, completion: {})
}
By clicking on your button your application go to the next view controller and the initial view controller will be dismissed.
I want to cancel animation of back preview. How can I do that?
.controller('DemoController', function($scope, $ionicHistory) {
$scope.goBack() = function(){
$ionicHistory.viewHistory().backView.go();
}
})
Use $ionicHistory.nextViewOptions() for this purpose.
This method can be useful to override certain view/transition defaults right before a view transition happens.
Available options:
disableAnimate: Do not animate the next transition.
disableBack: The next view should forget its back view, and set it to null.
historyRoot: The next view should become the root view in its history stack.
Set property disableAnimate to true for disable the animation
Controller
$ionicHistory.nextViewOptions({
disableAnimate: true
});
Refer
I have a view controller for my app that calls another view controller modally to cover the screen with a blur effect. Inside this other view controller, I'm displaying a TVApplicationController to display TVML content with transparent background on top of this blurred view.
let appControllerContext = TVApplicationControllerContext()
guard let javaScriptURL = NSURL(string: AppDelegate.TVBootURL) else {
fatalError("unable to create NSURL")
}
appControllerContext.javaScriptApplicationURL = javaScriptURL
appControllerContext.launchOptions["BASEURL"] = AppDelegate.TVBaseURL
appController = TVApplicationController(context: appControllerContext, window: nil, delegate: self)
appController?.navigationController.modalPresentationStyle = UIModalPresentationStyle.OverFullScreen
self.presentViewController((appController?.navigationController)!, animated: true, completion: nil)
What I want to do is, when I press the MENU button, to make the TVML content go away and to dismiss my modal blur view controller. The problem is that I'm not being able to detect the "dismissal" of the TVML content so I can close my modal view controller.
I tried to use the TVApplicationControllerDelegate to receive the messages that might come while using it but nothing helped.
I just found a workaround for this. I created a small class like this:
import UIKit
class HiddenView: UIView {
override func canBecomeFocused() -> Bool {
return true;
}
}
Then, what I did is to create an instance of this HiddenView on the ViewDidLoad of the blurred view controller and add it to the view controllers's view.
let hiddenView = HiddenView(frame: CGRectMake(0,0,10,10))
self.view.addSubview(hiddenView)
// it won't appear on the screen since it has no color/text/etc
Now, when I press the MENU button on the remote, when the TVML content is dismissed, the delegate method didUpdateFocusInContext on my blurred modal view controller is called, so I can dismiss it like this:
override func didUpdateFocusInContext(context: UIFocusUpdateContext, withAnimationCoordinator coordinator: UIFocusAnimationCoordinator) {
self.dismissViewControllerAnimated(true, completion: nil)
}
If anyone knows a better way to handle this than having to do this workaround, it would be nice to know.
In my app I have a "home" screen from which I can present a hamburger menu (coded as a modal transition in Storyboard).
The menu is a UITableView where a user will select a row. The menu has a delegate method which calls the following function in the presenting screen (my "home" screen)
// Menu delegate method
func menuDidExit(menuVC:MenuVC) {
self.dismissViewControllerAnimated(true, completion: {
// After dismissal of menu, call the chosen option
if let selectedOption = menuVC.menuSelection {
self.performSegueWithIdentifier(menuVC.menuSelection?.rawValue, sender: self)
}
})
}
This function will both dismiss the menu view controller, and then (once that transition is complete), present a second view controller based upon the chosen menu option, using the "performSegueWithIdentifier" command.
The issue that I have is that while the menu dismiss works fine (the menu slides off screen gracefully) - there is no animation for the presentation of the next view controller - it simply appears on screen after the menu has been dismissed.
I can call the desired view controller via a button/segue, and all works well, however when it is part of the completion block above it fails to animate the transition. This leads me to believe that there is something fundamentally wrong with my approach - hence the question, what is the correct way to push a second view controller after handling the dismissal of the first.
Many thanks for any suggestions
I think you can use this:
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
self.dismiss(animated: true) {
//dismiss your menu here
}
}
Hope it can help you.
Please let me know if it not work.
Thanks