Menu
  • HOME
  • TAGS

UIViewController LifeCycle

swift,uiviewcontroller,segue

In order to use an unwind segue, you start by setting up a method in the destination view controller. @IBAction func unwind(segue: UIStoryboardSegue) { // unwind } Note, that this method is placed in the destination view controller. The view controller being unwound to. From here, we need not the...

Performwithsegue and programatically switching views - Objective-C

objective-c,segue,viewcontroller

OK, what you are doing here is bypassing the segue completely. You need to do something like this... - (IBAction)Akkoord:(id)sender { [self performseguewithidentifier:@"nextcontroller"] } This is all you need to do. The segue will then create the nextController for you and then the code inside prepareForSegue will pass the variables...

Specify direction of “show” (push) segue

ios,objective-c,swift,segue

I don't believe there is a built in method for achieve that, however you could use Custom Transitions, which were introduced in iOS7. There are plenty of great tutorials out there, I've added some links below and some sample code demonstrating how you could slide the new view controller down...

Pass data from one view controller to the next WITHOUT a segue in swift

iphone,swift,uiviewcontroller,ios8,segue

So instead I was thinking to have a value associated with each button in the first view, have it sent to the second view via a segue, and then sent again to the third view and tell it to use the proper segue to the proper third view Controller...

Moving between UIViewControllers without Segue

ios,objective-c,uiviewcontroller,segue

Why don't you give each one a storyboard identifier, then grab anyone you need with its identifier using this: UIViewController *vc = [self.storyboard instantiateViewControllerWithIdentifier:@"identifier"]; Then present this view controller via push or present modally...

Receiver … has no segue with identifier error

ios,swift,segue

You should pass a the string in prepareForSegue function rather than didSelectRowAtIndexPath function. Instead of using didSelectRowAtIndexPath as below: override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { if segue.identifier == "ResultSegue" { if let indexPath = self.tableView.indexPathForSelectedRow() { var card: String if (tableView == self.searchDisplayController?.searchResultsTableView) { card = self.filtered[indexPath.row] } else...

How to both dismiss and deinit a (Game)ViewController using swift?

ios,xcode,swift,sprite-kit,segue

Of course it will memory leak. override func viewDidLoad() { navController = self } You just gave yourself a reference to itself. Usually when your vc goes offscreen, the view hierarchy no longer holds the view so the view is deinited. You set a reference to itself so whatever you...

iOS Segue opening two view controllers (assuming two table cells clicked)

ios,uitableview,segue,viewcontroller

A segue will be performed automatically while a cell is tapped. Try the following code: // - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath // { // self.selectedIngredient = self.selectedProduct.ingredientsArray[indexPath.row - 3]; // [self performSegueWithIdentifier:@"ingViewSegue" sender:self]; // NSLog(@"selected ingredient %@", self.selectedIngredient); // } #pragma mark segue - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { NSIndexPath *indexPath...

Load second app interface in a segue

ios,swift,segue,watchkit,apple-watch

Building my first Apple Watch app over here :) Looks like there is a concept of UINavigationController-ish behaviour built into the WKInterfacesController. Take a look at: pushControllerWithName(_:context:) And from some docs I found here: Hierarchical. This style is suited for apps with more complex data models or apps whose data...

Pass data beetwen view controller [duplicate]

ios,objective-c,segue,viewcontroller

You need to use -prepareForSegue to manage this situation, and you'll need an iVar to keep the restaurant name. So in the top of your map's .m file, add an ivar NSString @implementation yourViewController{ NSString *sRestName; //This is empty until the user selects a restaurant } -(void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view...

Why does my app react to taps outside a modal view?

ios,objective-c,segue

Use [UIView setUserInteractionEnabled: NO] on the background view when the modal view is presented.

click on UIImageView to change ViewController

ios,swift,parse.com,segue,uistoryboard

Just looking at your code, and knowing nothing else about your situation, I would guess that holder is nil. That would certainly be a reason by "nothing happens". You can easily test that with another println statement.

Swift - How to properly architect buttons in MVC?

ios,swift,uiview,uibutton,segue

button.addTarget(self, action: "buttonAction:", forControlEvents: UIControlEvents.TouchUpInside) button.addTarget(self, action: "saveButton:", forControlEvents: UIControlEvents.TouchDown) The normal thing is that the button should be sending messages to its view controller. That is the standard MVC thing to do - indeed, that is the VC in MVC (the View is letting the Controller know there has...

Add Delay to PresentViewController

objective-c,xcode,uiviewcontroller,segue,viewcontroller

It is not recommended to add delay for waiting an operation to be done (i.e. the login), instead you can use Grand Central Dispatch dispatch_async(dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^(void){ //Background Thread // do you login logic here dispatch_async(dispatch_get_main_queue(), ^(void){ //Main Thread : UI Updates UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil]; UIViewController...

Swift ios viewDidLoad or viewDidAppear

ios,networking,segue,lifecycle

You display whatever info you have in the viewDidLoad. Ideally you can have "Load More" button, which will further make the 2nd API call and update the view with fetched info. If you want to make the 2nd API call automatically, just go ahead and add it in the viewDidLoad...

No back button on segue in Swift 2

ios,swift,segue,swift2,ios9

Are you using show or show detail segue? It seems like you are using a modal segue. Destination view controller for show or show segue is usually the second view controller itself, and not embedded in another UINavigationController. If you're destination view controller for the show segue is really a...

Custom cell segue with data pass error - Swift

swift,tableview,cell,segue

It seems that you don't have any data to display in your array explanation, try to fix using this: if let i = self.tableView.indexPathForSelectedRow()?.row { if i <= explanation.count{ destination.explanation = explanation[i] <-- ERROR HERE } else { println("No explanationto display") } } However I would suggest you to use...

segue.identifier = nil in second view

ios,swift,segue

@Garret, @rdelmar, @syed-tariq - thank you for pointing me into the right direction. It turned out that Unwind Segue got me on track: Xcode Swift Go back to previous viewController (TableViewController) But I also found one error I was doing in my storyboard, as I had Navigation Controller on all...

iOS programmatically triggered segue is performed multiple times on success

ios,objective-c,iphone,segue,nsnotificationcenter

Found it: the problem was that the controller kept "listening" even when there was a failed message being sent because of the [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(logInAttemptComplete:) name:@"logInNotification" object:nil]; being inside the function of pressing the log in button. All I had to do was add the [[NSNotificationCenter defaultCenter] removeObserver:self name:@"logInNotification"...

Trigger Segue Artificially

osx,swift,segue,viewcontroller

Let assume that in your first ViewController you have one label and one button. When pressed, that button open popover (SecondViewController) with one textfield (and one button what says ready or close etc.), where you want take its value and assign it to your label. That is where delegates and...

Swift ios not sure on how to connect or use an embedded UIPageViewController

ios,swift,uiviewcontroller,segue,uipageviewcontroller

Embedding is actually a kind of segue that takes place as soon as the containing controller is instantiated, so the way to do this is to implement prepareForSegue on your containing controller, and capture a reference to your child controller within that method. Here's an example adapted from a project...

Why does my UITableView not perform show segue, only presents modally

ios,uitableview,swift,segue

Your ViewController has to be in a UINavigationController for it to work as a push. To do this, select your ViewController with the TableView and select Editor->Embed In->Navigation Controller from the menu at the top. As you noted, the UITabViewController isn't your issue, but you shouldn't segue to a UITabBarController....

Pushing a navigation controller is not supported - since Xcode 6.2 update

ios,xcode,uitableview,swift,segue

I have some problem and I guess that is Xcode's bug. My solution is to download and use Xcode 6.1.1 instead 6.2. P.S. In my case this problem happened just when segue is assigned to UIBarButtonItem. So, and after I'm relaunching Xcode popover segue is changed back to push segue....

prepareForSegue passes value for Index 0…ALWAYS

ios,objective-c,uitableview,segue

You should delete the button's action method, and connect the segue directly from the button to the next controller. In prepareForSegue, you can pass the button's origin, after converting it to the table view's coordinate system to the indexPathForRowAtPoint: method to get the indexPath of the cell that button is...

How use adaptive size classes to determine which segue to use?

ios,segue,size-classes

I don't believe it's possible to do this without code as of Xcode 6.3. However to use adaptive size classes rather than user interface idioms, your comment above could be written like this: if (self.traitCollection.horizontalSizeClass == UIUserInterfaceSizeClassCompact) { [self presentViewController:vc animated:YES completion:nil]; } else { [vc setPreferredContentSize:CGSizeMake(340, 560)]; [vc setModalPresentationStyle:UIModalPresentationFormSheet];...

Why is my variable is changing in printLn but not in the tableview Swift

ios,uitableview,swift,segue

i set up a quick demo project with the following viewcontrollers: class MainViewController: UIViewController { @IBOutlet weak var label: UILabel! @IBAction func unwind(segue: UIStoryboardSegue) { println("unwinding") if let sourceViewController = segue.sourceViewController as? ModalViewController { label.text = sourceViewController.selectedText } } } tapping on the label results in the modalviewcontroller to show....

Segue item info from CollectionView to ViewController

ios,objective-c,uicollectionview,segue

it has to be row instead of section in your prepareforsegue: destViewController.ID = [[_jsonArray objectAtIndex:indexPath.row] valueForKey:@"imagen"]; and btw: you can easily get the indexpath doing the following: NSIndexPath *selectedIndexPath = [self.collectionView indexPathForCell:sender]; ...

One UIAlertController function with multiple actions - is this possible?

ios,swift,segue,uialertcontroller

You would simply specify a different identifier, depending on which view controller you are unwinding to. Your AlertController would specify the correct identifier, depending on whether the user had logged out (unwind to login), or not (unwind to previous view). If you need to pass additional information, you can set...

How to do a “show (e.g Push)” segue programatically without animation?

ios,objective-c,swift,storyboard,segue

What the show (e.g. Push) segue does internally is to call -[UIViewController showViewController:sender:] Calling this method on your view controller itself, will trigger the appropriate way of presenting the view controller you are passing. // Swift self.showViewController(viewControllerToShow, sender: self) // Objective-C [self showViewController: viewControllerToShow sender: self]; The animation can be...

App crashes due to unrecognized selector sent to VC

ios,objective-c,exception,uinavigationcontroller,segue

You only need one Navigation Controller in any app which loads at launch time and will handle navigating the full stack of view controllers for you. It needs to be the root view controller, with the "Is Initial View Controller" box checked (under Attributes Inspector, View Controller) to give it...

Segue between UIViewControllers without Storyboard OR XIB

objective-c,xcode,uiviewcontroller,segue

You can use [viewController presentViewController:anotherController animated:YES completion:nil]; to present the view controller modally. Another alternative is to use a UINavigationController and do [viewController.navigationController pushViewController:anotherController animated:YES]; The second method will only work if viewController is in the stack of a navigationController...

iOS [Obj-C] segue based on matching keys in different MySQL tables in same DB

ios,mysql,objective-c,xcode6,segue

Okay -- here's a quick response to get you started. In your TopicViewController.h (the header) add: @property (nonatomic, retain) NSString * rID; @property (nonatomic, retain) NSString * rTopic; @property (nonatomic, retain) NSString * rDate; @property (nonatomic, retain) NSString * rContent; @property (nonatomic, retain) NSString * rBy; Change your CatViewController.m prepareForSegue...

How to segue to a new UIViewController at the end of an array count

ios,arrays,swift,uibutton,segue

You should check your index against count - 1 because index is zero-based. if currentQuestionIndex < questions.count - 1 && currentPlaceholderIndex < placeholder.count - 1{ currentQuestionIndex++ currentPlaceholderIndex++ buttonLabel.setTitle("Next", forState: UIControlState.Normal) } else { performSegueWithIdentifier("countdownSegue", sender: self) } EDIT: You didn't check the index when getting values from your array to...

Swift ViewController textFieldCancel:]: unrecognized selector sent to instance during segue [duplicate]

swift,cocoa-touch,ios8,segue

Check that there isn't an old connection from your button by right clicking on it in the storyboard and examining the outlets in the list. You may have an old connection that you forgot to eliminate.

xcode 6 - swift - passing a string through popover segue

swift,webview,segue,popover

Just the way you did it. If you are asking, how can I derive different strings from different buttons, the easiest way is to have different handlers that set a local variable, which is then proxied to the next VC as you have done. That is the most straight forward...

Xcode with Swift: How can I pass object back and forth in wizard steps?

xcode,swift,segue

Please check some attached images. It may help you to understand delegate if you not already aware of it. Attached first image is for segue and second for delegate. Segue Result ...

Multiple buttons that each segue to multiple ViewControllers

ios,swift,segue

You are actually close. Just a minor change to your performSegue: func performSegue(sender: UIButton) { if sender.description == wordTested { self.performSegueWithIdentifier(identifier: "segueToAnswerCorrect", sender: sender) } else { self.performSegueWithIdentifier(identifier: "segueToReviewCard", sender: sender) } } You then connect all of the 4 buttons to this function. Then you change the prepareForSegue: override...

Unwanted UITableViewCellAccessory magically appears after segue (Swift)

ios,uitableview,swift,uisearchbar,segue

I fixed this issue by dropping the entire UISearchDisplayController and implementing a UISearchController instead. Turns out the UISearchDisplayController was showing as deprecated in the latest Xcode beta build anyway....

Pass data through unwind segue

ios,swift,data,segue

If I understand your question correctly, you should do something like this: class MyPickerController : UIViewController { @IBOutlet weak var myLabel: UILabel! var pickerData:[String] func pickerView(pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) { myLabel.text = pickerData[row] performSegueWithIdentifier( "mySegueName", sender: self ) } func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { if...

Why is my swift code pausing at the loading screen?

ios,swift,uiviewcontroller,segue

It looks like you are running a while loop on the main thread which is also the thread responsible for drawing the UI. As long as that thread is stuck in your while loop there's no way for it's run loop to continue and no opporunity for it to update...

programaticlly load viewController class

ios,swift,segue,uistoryboardsegue

You can initiate nextview programetically this way: let storyboard = UIStoryboard(name: "Main", bundle: nil) let vc = storyboard.instantiateViewControllerWithIdentifier("someViewController") as! UIViewController self.presentViewController(vc, animated: true, completion: nil) ...

Swift Segue not working

ios,swift,segue

.indexPathForSelectedRow() returns an optional. You have to unwrap it, before you can access its properties. Try: let selectedIndexPath = popularTableView.indexPathForSelectedRow() detailsViewController.shots = shots[selectedIndexPath!.row] (see the exclamationmark)...

Segue not working on tableView

ios,action,segue

I'd like to suggest to you to use the delegate method to handle item selection: - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { // Here you can do something with, e.g. push a view controller: id vc = [self.storyboard instantiateViewControllerWithIdentifier:@"myVC"]; [self.navigationController pushViewController:vc animated:YES]; } In most cases it is more comfortable to...

How to segue from UIAlert and pass information

ios,swift,segue

Your prepareForSegue(_:sender:) method is embedded within your alertView(_:clickedButtonAtIndex:) method. While this is legal in Swift, UIKit won't call this method. It needs to be a method within your view controller subclass (like your alertView(_:clickedButtonAtIndex:) method). You may want to review some of the documentation on Xcode debugging; I think setting...

segue from multiple bar button items

ios,swift,uiviewcontroller,segue,rightbarbuttonitem

Create a segue from the controller (the one with the bar buttons) to the controller you want to segue to when the search button is touched. Call performSegueWithIdentifier:sender: in the "activate search" action method.

I am unable to add identifiers to segues. Is there a way to repair a ios xamarin storyboard?

ios,xamarin,monotouch,storyboard,segue

Right click the storyboard and open it up in Source Code Editor. Check that the XML matches up correctly, and identify the segues that you can't see....

Displaying a Picker View selection in another ViewController in Swift

swift,segue,picker

You can implement the UIPickerViewDelegate and UIPickerViewDataSource protocols to get data from the picker view. If you're just using it as an input for a text field, you can simply just set textField.inputView = pickerView instead of having the picker view on another controller....

How to change the value of a certain core data across VCs/ How to know the index of a created CoreData?

core-data,segue,viewcontroller

Your table view controller can keep a reference to the newly created object. Insert the object (trial) in the original view controller and pass it on to the next controller in prepareForSegue. So the CreateTrialViewController starts out with a blank object to which the table view controller has a reference....

Passing data forward to destination VC (with framework) in Swift?

ios,xcode,swift,uiviewcontroller,segue

SOLUTION: Added to "Copy Bundle Resources" and then my VC was immediately recognized by the compiler....

prepareForSegue won't work with custom segue (swift)

ios,swift,segue

Change to override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { if segue is CustomOpenSegue { let customOpenSegue = segue as! CustomOpenSegue customOpenSegue.iconFrame = sender!.view!.frame } } If you override a method, you can't change the parameter types....

Calling prepareforSegue from a UIButton?

ios,swift,uitableview,uibutton,segue

Solved. I passed the index via UIButton option tag and replaced the indexPathForSelectedRow.

Objective-C prepareForSegue Issue

ios,objective-c,uitableview,segue

I wonder why your data source is different in cellforrow and prepare for segue. If you manage the same way as sections and rows. You need to get data from datasource firstly by indexpath.section and then indexpath.row change this in prepareforsegue method.

Why performSegueWithIdentifier creates always a new instance?

ios,storyboard,segue

Yes, it always will create a new instance. have no doubt for that. Because that command equal to create a new object and push it (or present it). there's a lot of way to walkthrough it. In my case, i usually create questionViewController with an button, and by that button,...

Segue won't execute Swift

ios,uicollectionview,segue

I will suggest not to create segue(s) from cell or any object(like button). Create segue from one ViewController to OtherViewController with unique identifier. And then call the performSegueWithIdentifier yourself using the identifier.

Replace-root-view-controller custom segue with animation?

ios,objective-c,storyboard,segue,uistoryboardsegue

There are numerous ways you could add a "nice animation". Here is an example of a sort of card shuffle animation where one view moves up and left, while the other moves down and right, then reverses after changing the z-order of the two views. This implementation inserts the destination...

Swift - UIStoryboardSegue pop up ViewController programatically

swift,popup,storyboard,segue

you can use dynamic popup views like that let vc = storyboard.instantiateViewControllerWithIdentifier("myPopupView") as! myPopupViewViewController self.presentViewController(vc, animated: true, completion: nil) ...

Swift: Custom class array in table view - editing the values: accessory segue or other?

uitableview,swift,segue,accessoryview

A segue is not only the simplest way to accomplish this, you can also take advantage of an unwind segue to automatically return your edited values. No delegation needed. No custom code to add hidden views to your cell. If you only have one segue, add it to the row,...

Swift - Passing data along with segues

ios,swift,uiviewcontroller,delegates,segue

You are currently calling sendName and sendImage delegates before assigning them any value . Thats why they are not getting to your InformationViewController. You should do something like that: override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { if segue.identifier == "newReciep" { var vc = segue.destinationViewController as! DetailsViewController vc.delegateDetails = self...

how to make a page accessible from every other page in my app and able to unwind to where the segue comes from

ios,objective-c,swift,segue,unwind-segue

Yes, you can do this without having a segue from each controller, but it depends on how your controller hierarchy is set up. If for instance, you have a navigation controller, and all your view controllers are pushed onto its stack, you can create one segue from the navigation controller...

Is it possible to use unwind segues in WatchKit?

storyboard,segue,watchkit

After developing extensively with WatchKit, I can tell you they aren't. WatchKit doesn't use a traditional navigation controller.

Audio from MPMoviePlayerController continues playing after segue to next view controller

swift,segue,mpmovieplayercontroller

Tell your video to stop before segueing to the next view controller. override func prepareForSegue(segue: UIStoryboardSegue?, sender: AnyObject?) { objMoviePlayerController.stop() } MPMediaPlayback Protocol Reference...

indexPath variable not inheriting value

ios,swift,tableview,segue

You can send indexPath of your selected cell as sender object in performSegueWithIdentifier method since you are not using it at all. Then in prepareForSegue unwrap and cast sender to NSIndexPath and use it to pass data to next controller func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { var sound =...

Changing button label in the container view by clicking button in the main view

ios,swift,cocoa-touch,containers,segue

I solved the problem by removing the child view which has already created at the first start.. @IBAction func insertButton(sender: AnyObject) { if (shiftNo != 3) { shiftNo++ } else { shiftNo = 1 } var childView = self.childViewControllers[0] as! UIViewController childView.willMoveToParentViewController(nil) childView.view.removeFromSuperview() childView.removeFromParentViewController() performSegueWithIdentifier("container", sender: self) } ...

swift: delegate is nil after segue

delegates,protocols,segue,nil

First way is to use prepareForSegue and declare in it all your delegate methods. Second way is to use NSNotificationCenter and with this transfer your delegate so this works with pushToViewController...

Add segue to dynamically created cells

ios,uitableview,swift,uicollectionview,segue

You should set up segues in the Interface Builder but not from a button but from a view controller and set appropriate identifiers. Use this method to start a segue: - performSegueWithIdentifier:sender: ...

How do I send data to destination view controller?

ios,objective-c,uiviewcontroller,segue

It looks like you add it to UINavigationViewController stack, try this: - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { if ([[segue identifier] isEqualToString:@"showClue"]) { UINavigationController *dest = (UINavigationController *)segue.destinationViewController; ClueDetailViewController *viewController = (ClueDetailViewController *)dest.topViewController; viewController.testString = @"This is a test"; // causes runtime crash } } ...

TableViewCell title and subtitle to detail view controller (segue help)

ios,objective-c,uitableview,segue,detailview

You can get the currently selected cell and pass the values in the prepareForSegue: method. -(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { UIViewController *destinationViewController = segue.destinationViewController; UITableViewCell *selectedCell = [self.tableView cellForRowAtIndexPath:self.tableView.indexPathForSelectedRow]; destinationViewController.title = selectedCell.textLabel.text; //Add code to set label to selectedCell.detailTextLabel.text } ...

Which “init” method does segue call on UIViewController?

ios,object,segue

It is this method initWithCoder I think this solution is better You write some common code in -(void)setUp{ //Set up } Then you put this code in every initMethod: -(instancetype)initWithCoder:(NSCoder *)aDecoder{ if (self = [super initWithCoder:aDecoder]) { [self setUp]; } return self; } -(instancetype)init{ if (self = [super init]) {...

Can't pass variable into prepareForSegue in Swift?

ios,swift,segue

The prepareForSegue: method is called before tableView:didSelectRowAtIndexPath: method.And I saw that you only assign selectedName in method didSelectRowAtIndexPath.So selectedName will always be nil in prepareForSegue. You can assign selectedName in tableView:willSelectRowAtIndexPath: override func tableView(tableView: UITableView, willSelectRowAtIndexPath indexPath: NSIndexPath) { let row = self.tableView.indexPathForSelectedRow()!.row println("row \(row) was selected") selectedName = people[indexPath.row]...

Popover segue from NSCollectionViewItem

objective-c,osx,cocoa,segue,nscollectionviewitem

Storyboards are relatively new to OS X. NSCollectionView seems to not get much love from Apple. There have been numerous reports that the combination of NSCollectionView and storyboards is buggy. So, you may be better off doing this the non-storyboard way. It may be simplest to connect the button to...

How to make a segue from SpriteKit GameScene to UIViewController programmatically in iOS 9 with Swift2

sprite-kit,segue,identifier,swift2,ios9

Segue identifiers are String objects, so you should call performSegueWithIdentifier with "push" instead of referencing it as a variable. This code should work: func segue(){ self.viewController.performSegueWithIdentifier("push", sender: viewController) } ...

prepareForSegue crashes when segueing in Core Data app

ios,objective-c,core-data,segue

In this line CGPoint point = [sender convertPoint:CGPointZero toView:self.tableView]; you’re calling convertPoint:toView: on your SavedPOITableViewController, but this isn’t a method of your view controller, it’s a method of the view. Try this instead: CGPoint point = [self.view convertPoint:CGPointZero toView:self.tableView]; ...

What would cause my segue to infinitely loop?

ios,swift,segue

I suppose this was pretty obvious, but my update was getting called every second... because i told it to. And I put my performSegueWithIdentifier inside it. So, easy fix. var segueFlag = false func update() { countdownLabel.text = "\(count)" if count == 0 { timer.invalidate() if segueFlag == false {...

segueForUnwindingToViewController causing “Warning: Attempt to present <…> on <…> which is already presenting <…>”

ios,swift,segue,uistoryboardsegue,unwind-segue

Created Sample code for unwind segue with above transition animation code. Checkout SampleUnwind project that will help you to understand unwind segue(and how simple it is). In project there is one navigation controller and inside it there are three view controller (Home->First->second). In Home controller following unwind action is created,...

Check the Sender of a Segue

ios,segue

you can try this if([sender isKindOfClass:[MyViewControllerClass class]){ //do stuff } ...

I am trying to pass a string from one view controller to another view controller while unwinding using segues and I am not able to do so

ios,swift,segue,viewcontroller

Here is some example code to implement a main controller segueing to a second VC, and the second unwinding to the main controller. Notice that in the function the second cVC unwinds to, you can refer to the second controller and access a variable in the second controller. If you...

prepareForSegue UICollectionView not working (swift)

ios,swift,xcode6,uicollectionview,segue

You need to add the UICollecitonViewDelegate func collectionView(collection: UICollectionView, selectedItemIndex: NSIndexPath) { self.performSegueWithIdentifier("showDetail", sender: self) } After that add override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { if segue.identifier == "showDetail" { if let indexPath = self.collectionView?.indexPathForCell(sender as! UICollectionViewCell) { let detailVC = segue.destinationViewController as! DetailMenuViewController detailVC.picFood = self.collection[indexPath.row] } }...

How to pass data between controllers? [duplicate]

ios,uitableview,swift,segue

You are calling dequeueReusableCellWithIdentifier this gives you a new cell, if you want to access the values in that cell you need to access the data source for the cell in question as in the code below: override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { if segue.identifier == "identifierDetail" { if...

UIStoryboardSegue: view is not displayed during animation

ios,xcode,swift,segue,unwind-segue

Your initial position for the destination vc's view is setup incorrectly (assuming that you want the view to move in from the right); you have it positioned below the screen, instead of to the right of the screen, secondVCView.frame = CGRectMake(0.0, screenHeight, screenWidth, screenHeight) This should be, secondVCView.frame = CGRectMake(screenWidth,...

How to hide the back button from the status bar on the Apple Watch?

swift,segue,watchkit

If you check the docs for WKInterfaceController, you'll see there's no API to accomplish what you're looking for: https://developer.apple.com/library/prerelease/ios/documentation/WatchKit/Reference/WKInterfaceController_class/ The best you can do is change the text of the title/button or adjust the tint color....

Call storyboard scene without creating a segue in swift?

ios,swift,uiviewcontroller,segue

Your code doesn't work because you need to setup a segue in storyboards with a specific ID that you pass as an argument when you call performSegueWithIdentifier. So, in your case, you need to create a segue with ID "SegueID", since that is the string that you are passing to...

how to access segue in 'didSelectRowAtIndexPath' - Swift/IOS

ios,uitableview,swift,segue

You should be using the didSelectRowAtIndexPath method to determine whether or not a cell was selected. func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { self.performSegueWithIdentifier("showQuestionnaire", sender: indexPath); } Then in your prepareForSegue method override func prepareForSegue(segue: UIStoryboardSegue!, sender: AnyObject!) { if (segue.identifier == "showQuestionnaire") { let controller = (segue.destinationViewController as! UINavigationController).topViewController...

Added navigation bar but there is no back button?

ios,uitableview,swift,segue,uistoryboardsegue

Embed the TableViewController inside the NavigationController. Not the DetailViewController directly. Check out the screenshot. Make sure, that the segue, connecting your TableViewController and your DetailViewController is of type Show (e.g. Push). You have to literally push a new View on top of the Navigationstack. ...

Segue doesn't transfer array

arrays,swift,segue

You've got prepareForSegue as an nested function inside nextPage. Move it outside and it should work fine: @IBAction func nextPage(sender: AnyObject) { self.performSegueWithIdentifier("answerSummary", sender: sender) } override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject!) { if let answerSummary = segue.destinationViewController as? QuizResultsViewController where segue.identifier == "answerSummary" answerSummary.answers = finalResultsSegue } } The...

Swift : Pass TableViewCell text to new ViewController's cell

ios,uitableview,swift,segue,tableviewcell

Your issue is that you're not passing any information to your detailViewController about the contents of the selected cell. Do this instead: override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { if ( segue.identifier == "toInfo") { if let indexPath = tableView.indexPathForCell(sender as! UITableViewCell) { var detailsVC = segue.destinationViewController as! DetalisTableViewController println(thecourseName[indexPath.row])...

Swift iOS: Perform a Segue from an Instance in a ViewController to another ViewController

swift,button,uiviewcontroller,segue

You cannot call other view from showInView, you need to dismiss the popOver and call the mainView from GameScene, to do so you can create a competition handler in your PausePopup or a protocol to pass the result of your popOver to GameScene deal with the result

How to segue from one viewcontroller to another

ios,swift,segue

Drag a segue from view controller1 to view controller2,not from any button Set a identifier of your segue Use this function to fire a segue. self.performSegueWithIdentifier("youridentifer", sender:nil); ...

dismiss a modally presented view controller to a different underlying view controller

ios,uiviewcontroller,segue

There are different ways to approach this. One way is to replace the initial presenting view controller with the desired underlying one when you present the modal view controller. NSArray * viewControllers = [self.navigationController viewControllers]; [viewControllers replaceObjectAtIndex:viewControllers.count - 1 withObject:replacementController]; Dismissing the modal will simply show the different underlying view...

performSegueWithIdentifier error

ios,swift,segue

Instead of using UIButton.self as sender, use sender. And you can't use a closure with performSegueWithIdentifier: performSegueWithIdentifier("addMapItem", sender: UIButton.self) { // Some code } use: performSegueWithIdentifier("addMapItem", sender: sender) and my guess is you forgot to add self in this line: destination.savedItems = annotations // Should be self.annotations This is where...

Segue must be modal with page navigation

storyboard,segue,watchkit,uistoryboardsegue,apple-watch

Page-based navigation and hierarchical navigation are exclusive – you can't mix and match unless you present a new interface modally. This is expected behaviour.

Hide a UIViewController (Screen) in swift

swift,uiviewcontroller,uitabbarcontroller,segue,xcode6.3

Yes, u can hide UIViewController. As your UIViewController is nothing but the a normal UIView. So just create an @IBOutlet for you UIView and use .hidden method like this @IBOutlet weak var mainview: UIView! override func viewDidLoad() { super.viewDidLoad() mainview.hidden = true } Edit: Correctly specify what you want to...