segue

How can I dismiss a modal segue then perform push segue to new view controller

烂漫一生 提交于 2019-12-07 05:31:54
问题 I'm trying to perform a push segue from a navigation controller , after dismissing a modal that was previously presented over the navigation controller . Inside modal ( UIViewController ): func textFieldShouldReturn(textField: UITextField) -> Bool { var searchNav = SearchNavigationController() self.dismissViewControllerAnimated(true, completion: {searchNav.goToNextView()}) return true } Inside SearchNavigationController : func goToNextView() { performSegueWithIdentifier(

Using Segue Manually

流过昼夜 提交于 2019-12-07 04:59:20
问题 I need to create two Segue's from the same button, and then I want to programatically choice which one to use based on device orientation. The problem I'm having is that you can only seem to create one segue from a button to another view so when I add the second one it just changes the first. How do you add a segue that either isn't linked to a button etc so I can do programatically or how are you supposed to do this. I want to have two views that get dynamically picked based on orientation

How do I add a segue to an UIGestureRecognizer

扶醉桌前 提交于 2019-12-07 02:07:25
问题 I am building an app for the first time using Storyboards. I have a scene which I would like to have open another scene when there is a long tap on a particular button. I am able to add the UILongPressGestureRecognizer with no problem, but I can't figure out how to have that gesture be the segue to the other scene. Doesn't seem to matter what I Ctrl-Drag, nothing works. Am I missing something obvious? Thanks, Ken 回答1: You can control-drag from your first controller's window to your second

No back button on segue in Swift 2

微笑、不失礼 提交于 2019-12-07 00:35:55
问题 I just ported my project over to Swift 2, and everything is working great - except that even the most simple segues have no back button. Here is the prepare for segue function that I am using: override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { // Get the new view controller using [segue destinationViewController]. // Pass the selected object to the new view controller. if segue.identifier == "showExercise" { if let nav = segue.destinationViewController as?

Reference to the segue source view controller

别等时光非礼了梦想. 提交于 2019-12-06 23:15:44
问题 Within my viewDidLoad I would like some custom code based upon the previous controller. How can I access the segue source controller or the previous segue identifier in the destination controller's viewDidLoad to handle this? 回答1: There is no way to get a reference to the segue that created you. You could create a property (sourceVC in my example) in the destination controller, and assign self to this property in the prepareForSegue method (in the source view controller): [(DestinationVCClass

UIBarButtonItem + popover segue creates multiple popovers

元气小坏坏 提交于 2019-12-06 22:38:45
问题 I've currently have an iPad app with a UIToolbar containing two UIBarButtonItems, each of which is connected to a popover segue. When the user touches either of the UIBarButtonItems, the popover is created rather than toggled. This creates multiple, overlapping popovers. I've been able to close the previously created popover using the following code - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { // First close the preferences popover if it's open per Apple guidelines

ios segue “cancel”

回眸只為那壹抹淺笑 提交于 2019-12-06 19:09:23
问题 Depending on an XML return, I don't want the current segue to perform on UIButton touch. I know I can pick which segue I want to perform , but how to I make a segue not perform? Or at least not perform any of the available segues ? 回答1: If your deployment target is iOS 6.0 or later, you can override the -[UIViewController shouldPerformSegueWithIdentifier:sender:] method to return YES if you want to perform the segue and NO if you don't. If your deployment target is earlier than iOS 6.0, you

How to swipe gesture segue back to previous view ios?

牧云@^-^@ 提交于 2019-12-06 16:45:37
I'm trying to segue back to (QueryController) the view i came from. But no swipe actions occurs... Not sure what im missing. @implementation ProfileController4 - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { // Custom initialization UISwipeGestureRecognizer * Swiperight=[[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(swiperight:)]; Swiperight.direction=UISwipeGestureRecognizerDirectionRight; [self.view addGestureRecognizer:Swiperight]; UISwipeGestureRecognizer

passing data with performSegueWithIdentifier nil

醉酒当歌 提交于 2019-12-06 16:24:40
问题 I have the segue setup as: and the tableView row selection: override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { tableView.deselectRowAtIndexPath(indexPath, animated: true) // Ensure controller knows which dataset to pull from, // so detail view is correct var friendChat: Friend! if searchController.active && searchController.searchBar.text != "" { friendChat = filterMappedFriends[indexPath.row] } else { friendChat = mappedFriends[indexPath.row] }

Dismiss modal, then immediately push view controller

给你一囗甜甜゛ 提交于 2019-12-06 15:33:50
How can I dismiss a modal and then immediately push another view? I am adding this code in a didSelectRowAtIndexPath: UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil]; ChatTableViewController *chatVC = (ChatTableViewController*)[storyboard instantiateViewControllerWithIdentifier:@"chatVC"]; [self dismissViewControllerAnimated:YES completion:^{ [[self navigationController] pushViewController:chatVC animated:YES]; }]; The modal view dismisses, but nothing happens after. Any ideas? You can't push a view controller into a view dismissed, if it's dismissed it