pushviewcontroller

Modifing one variable from another view controller swift

Deadly 提交于 2019-11-30 10:31:13
I am developing an app in Swift that, in gist, tells people the price of Bitcoin in various currencies. To select the currency, the user chooses from a list in a view controller with a UITableView. This is currencyViewController, and it is presented from my main screen, viewController. What I want to happen is that, when the user dismisses currencyViewController, it passes a string to a UIButton in the main viewController. Here's the prepareForSegue function that should pass the data: override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject!) { if (segue.identifier ==

Why can’t UIImagePickerController be pushed into navigation stack?

你说的曾经没有我的故事 提交于 2019-11-30 00:50:32
问题 When using pushViewController to push UIImagePickerController : [self.navigationController pushViewController:pvc animated:YES]; an error will occur such as: Pushing a navigation controller is not supported The right solution is to use presentModalViewController : [self presentModalViewController:pvc animated:YES]; Can someone explain why this is necessary? What‘s hidden in UIViewController ? Thanks! 回答1: Apple does not allow stacking of navigation bars. Since the image picker has its own

What exactly willMoveToParentViewController: and didMoveToParentViewController: do?

半世苍凉 提交于 2019-11-30 00:17:55
I know that starting with iOS5 and the new UIViewController containment methods, you are supposed to call these methods together with addChildViewController: , removeFromParentViewController: and the transition method. I also know the proper order of calling them in the three scenarios. What I don't know is what exactly these methods do? If these were merely override points for subclasses of UIViewController I guess we wouldn't be required to call super when overriding. What can/will go wrong if I don't call willMoveToParentViewController: nil before removing a view controller or

ios 7 view with transparent content overlaps previous view

百般思念 提交于 2019-11-29 21:21:51
Recently I updated my xcode project to work with iOS 7, but i faced a big problem. Because my whole application has only one background image (UIImageView added to key window) and all views are transparent, I face a problem when pushing UIViewController, because pushed view controller overlaps previous view (you can see it in the picture here: http://grab.by/qp0k ). I can predict that this is because in iOS 7 push transition has been changed, because now it slides half a screen. Maybe anyone knows how to fix this issue? This is how I set my key windows self.window = [[UIWindow alloc]

Modifing one variable from another view controller swift

与世无争的帅哥 提交于 2019-11-29 15:45:37
问题 I am developing an app in Swift that, in gist, tells people the price of Bitcoin in various currencies. To select the currency, the user chooses from a list in a view controller with a UITableView. This is currencyViewController, and it is presented from my main screen, viewController. What I want to happen is that, when the user dismisses currencyViewController, it passes a string to a UIButton in the main viewController. Here's the prepareForSegue function that should pass the data:

How do i set a modal segue (programmatically) to a push segue

风格不统一 提交于 2019-11-29 11:44:01
i have an navigation controller in my storyboard, but for one reason i have to make one segue programmatically, but how do i make a push segue programmatically? this is my code so far: - (IBAction)nextviewButton:(id)sender { HolesViewController *Holes = [self.storyboard instantiateViewControllerWithIdentifier:@"HolesViewController"]; Holes.nameString = self.NameField.text; [self presentViewController:Holes animated:YES completion:nil]; } Alternatively, I actually prefer to define a segue right in my storyboard, but rather than originating from the button, I have it originate from the view

push to another view controller without prepareForSegue

南楼画角 提交于 2019-11-29 09:25:35
问题 How can you push to another view controller without prepareForSegue ? myClassVC *viewController = [myClassVC alloc]; UIStoryboardSegue *segue = [[UIStoryboardSegue alloc] initWithIdentifier:@"pushToMyVC" source:self destination:viewController]; if ([segue.identifier isEqualToString:@"pushToMyVC"]) { NSLog(@"logging"); myClassVC *viewController = (myClassVC *)[segue destinationViewController]; [self presentViewController:viewController animated:YES completion:nil]; } 回答1: If you want to

How come some of my UIViews are shifted after navigation?

China☆狼群 提交于 2019-11-28 20:50:15
In some of my application designs or for just some UIViews, following a navigationController's pushViewController, my new view will be shifted off the window by the height of the status bar. As a result, I will put this code stub in the viewDidLoad method. CGRect frameAt = [self.view frame]; CGRect statusBarFrame = [[UIApplication sharedApplication] statusBarFrame]; frameAt.origin.y += statusBarFrame.size.height; [self.view setFrame: frameAt]; It does not make sense to me that this is the intention of XCode and Interface Builder, so I suspect that I am doing something fundamentally wrong with

Is it possible to push a View Controller with a completion block?

感情迁移 提交于 2019-11-28 18:49:40
UINavigationController's documentation contains no pushViewController methods with a completion: parameter. I would go with @justMartin's answer . But below is another approach. push animation take 0.3 seconds.So, if you want to run some function here after completion use performSelector after 0.3 seconds of delay. [self performSelector:@selector(completedPushing:) withObject:nil afterDelay:.3]; OR After pushing the new viewController onto navigation stack ,the old viewController view is removed from view hierarchy.so this results in call of viewDidDisappear on old ViewController.You can write

ios 7 view with transparent content overlaps previous view

我与影子孤独终老i 提交于 2019-11-28 17:27:12
问题 Recently I updated my xcode project to work with iOS 7, but i faced a big problem. Because my whole application has only one background image (UIImageView added to key window) and all views are transparent, I face a problem when pushing UIViewController, because pushed view controller overlaps previous view (you can see it in the picture here: http://grab.by/qp0k). I can predict that this is because in iOS 7 push transition has been changed, because now it slides half a screen. Maybe anyone