Posts

Showing posts with the label uiviewcontroller

Swift iOS -How to Switch / Toggle between two UIWindows and make either the keyWindow

Image
Swift iOS -How to Switch / Toggle between two UIWindows and make either the keyWindow I created an additional UIWindow that will get presented on top of the main window. The user presses a button and it transitions over the main window. The user can minimize the additional window and it will sit above the tabBar like it the picture below. They can enlarge it to cover the main window or dismiss it and it gets destroyed. It works fine. I also created a custom action sheet that launches from the bottom of the screen. If the additional window completely covers the main window and the action sheet is launched, it will launch perfectly inside the additional window. If the additional window isn't on the screen it launches perfectly inside the main window. The problem is if the additional window is minimized on screen and I want to launch the action sheet from the main window, the action sheet launches inside the additional window instead, it cannot distinguish between the two. I opened ...

Initial ViewController still showing after segue

Image
Initial ViewController still showing after segue The app I am currently working on requires that I do not use ANY storyboards. Therefore I need to do everything programmatically. One thing I seem to be struggling with is switching between two UIViewControllers. The code I am using to go from VC1 to VC2 is: self.present(signUpVC(), animated: true, completion: nil) And the code I am using to go from VC2 back to VC1 is: self.dismiss() The problem I seem to be facing is that as VC2 is coming up, VC1 is still visible in the background (frame 1): Here is the next frame: This is the final frame of the transition, and as you can see, the initial view is still visible in the background (Frame 3): Is there any way I can fix this issue? Is the background of the view controller clear? Show some code – Scriptable Jun 29 at 22:20 ...

adding UIViewcontroller's view to UIWindow does not show

adding UIViewcontroller's view to UIWindow does not show I am trying to see a view with the following code where I am using storyboard however I did not make the uiviewcontroller's scene initial view controller. This is the code I wrote in didFinishLaunchingWithOption of my AppDelegate. UIWindow* window = [UIApplication sharedApplication].keyWindow; abcViewController *controller = [[abcViewController alloc]init]; UIView *redView = [[UIView alloc] initWithFrame: CGRectMake ( [[UIScreen mainScreen] bounds].origin.x+30, [[UIScreen mainScreen] bounds].origin.y+30, 260, 400)]; [redView setBackgroundColor:[UIColor redColor]]; UIView *greenView = [[UIView alloc] initWithFrame: CGRectMake ( redView.frame.origin.x + 10.0f, redView.frame.origin.y + 10.0f, 180, 320)]; [greenView setBackgroundColor:[UIColor greenColor]]; [redView addSubview:greenView]; [controller.view addSubview:redView]; window.rootViewController = controller; [window makeKeyAndVisible]; return YES; ...