Move to different screens at WatchOS - watchos

I´m trying to navigate to different screens with WatchOS but when i choose this action in a button:
[self presentControllerWithName:#"Screen2" context:contextDic];
The Screen2 open correctly but inside this screen i have a button with this action:
[self pushControllerWithName:#"Screen1" context:context];
And this button doesn´t work and i can´t go to the Screen1. How i can push the button of this Screen2 and itself close and go back to the Screen1? I have use presentControllerWithName at this screen2 but i don´t want at top the previous button.

You should use the method popController to go back to a previous interface controller.
After pushing an interface controller onto the screen, use this method to remove it and display the previous interface controller again. The system animates the transition back to the previous interface controller asynchronously.
Note: This method is only available in watchOS 2.0.
See more in the WKInterfaceController class reference.

Related

How to trigger a pop up window from another pop up window in Objective C

I want to open a popup from another popup and I used the below code, but when I click the pop up it moves to a new page instead of showing another popup. is there a way to create a popup effect with navigationController?
[weakself.navigationController pushViewController:deleteVC animated:YES];
Instead of pushing the view controller to the navigation stack, use presentViewController:animated:completion: method to open it modally.
It's important that you send this message to the presenting view controller itself, not to the navigation controller:
[weakself presentViewController:deleteVC animated:YES completion:nil];

how to hide navigation bar when add flutter to existing iOS app

how to hide navigation bar when add flutter to existing iOS app. I don't want to hide navigation bar in the iOS page.
I know nothing about Flutter, but like any view controller, flutterViewController.navigationController will return nil until it's actually a child of the navigation controller. In your code you have just created it but not added it anywhere. So the rest of that line (setting the navigation bar hidden to YES) is never actually executed.
Call self.navigationController.navigationBarHidden = YES; to hide it, in that code, since self is in the view controller hierarchy (and it's the same nav controller instance you are targeting anyways).

applicationDidEnterBackground method not getting called neither did applicationWillResignActive when My application goes in the background iOS 7

I am developing a banking application and the client requirement is not to show/save the screen snapshot when app goes in the background (i.e., when home button is clicked).
I have added an overlay view in background method and removed that view when app again comes in the foreground. Its working perfectly fine when I click home button, wait for 1 or 2 secs and then again click home button twice.
My problem is: If I click home button once, wait for some milliseconds (just before the app icons visible)and then again click home button twice, then the screen snapshot is visible (in multitasker view).
When I analysed the issue, I came to know that my background delegate method doesn't get called in this scenario and hence, no overlay view is added in this case.
Steps to Reproduce:
Add An overlay view (with while color, lets say) in appDidEnterBackground Method of your application.
Add code for removing that overlay view in willEnterForeground Method.
Now, run your application.
Press Home button once.
Just after pressing home button once (and just before your application icon is visible), click home button twice so that you are able to see the Multitasker view.
Instead of your overlay view, you would be seeing the application screenshot there.
Expected Results:
The While overlay view should have been added, and you should have seen that instead of app snapshot.
Actual Results:
You are able to see the application screen shot in Multi tasker view
Version:
iOS 7 and above
I've created an app that does exactly what you want. I throw up the shield image view in applicationWillResignActive:
- (void)applicationWillResignActive:(UIApplication *)application {
// ...
self.shieldImageView = [[UIImageView alloc] initWithFrame:self.window.frame];
self.shieldImageView.image = [UIImage imageNamed:#"shieldimage"];
self.shieldImageView.contentMode = UIViewContentModeScaleAspectFit;
[self.window addSubview:self.shieldImageView];
// ...
}
and get rid of it in applicationDidBecomeActive:
- (void)applicationDidBecomeActive:(UIApplication *)application {
// ...
[self.shieldImageView removeFromSuperview];
self.shieldImageView = nil;
// ...
}

How do I hide the master part of a UISplitViewController programatically?

In my UISplitViewController, I want the "master" part of the view to hide itself and the "detail" part take over the full screen when the user clicks a button in landscape. Likewise, clicking the button again takes the user back the standard, split screen view. Is it possible to do this with the built-in class?
There's a method you can implement from UISplitViewControllerDelegate in iOS5:
- (BOOL)splitViewController:(UISplitViewController*)svc
shouldHideViewController:(UIViewController *)vc
inOrientation:(UIInterfaceOrientation)orientation
{
return YES;
}
MGSplitViewController has that functionality built in for pre-ios5 work.

Dismissing a modal view controller using a different animation than it was presented with

I have an application that presents a view controller (for registering / logging in) with a container view, and two views as switched between eachother using horizontal flipping. The app itself can be used before registration. I'm looking to change the way this is handled with storyboarding.
So upon opening the app there's a login button. If the user taps login a view controller is presented using Cover Vertical animation. On the top left of this view controller is a button to Register. Tapping on that does modal segue with a Horizontal Flip animation. On the Register view controller there's Login and Cancel buttons. I want Login to return to the login screen, and Cancel to go back to the view controller that was displayed using the Cover Vertical animation. Getting it there is fine, but the animation used is the Horizontal Flip animation, and not a (un)Cover Vertical animation.
I'ved tried the following code:
self.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
before dismissing the view controller, but it's still flipping instead of uncovering.
Thanks for the help!
~James
I see no reason that shouldn't work, but as an example here's the code I would use:
[self setModalTransitionStyle:UIModalTransitionStyleCoverVertical];
[self dismissModalViewControllerAnimated:YES];
I suggest trying this, it works well for me.
for Swift you can call this:
viewController.modalTransitionStyle = .coverVertical
viewController.dismiss(animated: true, completion: nil)