Questions tagged [uistoryboardsegue]

UIStoryboardSegue is the Cocoa Touch class for segues used in storyboards in iOS 5.0 and later. Segues represent the relationship between two different scenes (i.e. view controllers) on a storyboard, generally used for facilitating the transition between two scenes.

UIStoryboardSegue is the Cocoa Touch class for segues in storyboards in iOS 5.0 and later. Segues represent the relationship between two different scenes (i.e. view controllers) on a storyboard, generally used for facilitating the transition between the two scenes.

Segue types

The two most commonly used action segues include:

  • Push segues: Used in conjunction with a navigation controller to push from one scene to another, useful for representing workflows that may consist of multiple levels of scenes; and

  • Modal segues: Used to present a new modal scene, often a self contained scene that must be dismissed before control returns to the presenting view controller and the main workflow of the app.

  • Show Detail segues: Used to present a scene in detail view controller of UISplitViewController. This way we can have multiply detail view scenes.

Less common action segues include:

  • Custom segues: Used to represent a new scene using a custom transition when the standard segues are unable to achieve the desired effect, e.g. a custom animation to perform in conjunction with a segue;

  • Unwind segues: In iOS 6 and higher, an unwind segue can be defined that lets the application unwind one or more segues back to a particular scene, achieved by defining (a) defining an unwind action in one of the preceding view controllers; and (b) creating a segue from a control in a scene to the "exit" outlet in the bar below its scene. Unwind segues are not represented visually on the storyboard, but nonetheless offer an easy and flexible way of jumping back levels, dismissing and popping the intervening scenes as appropriate.

There are other segue types, including:

  • Embed segues: When using custom container views in iOS 6 or higher, an embed segue represents the relationship between a parent view controller and its child view controller;

  • Replace segues: When targeting an iPad and using a split-view controller, you can also define a replace segue that replaces one of the splits (either the "master" or the "detail") with a new scene; and

  • Popover segues: When targeting an iPad, a popover segue can be used to present a popover view (with its own view controller).

Optional segue-related methods

When using segues, to set a property in the destination controller, write a prepareForSegue method. In iOS 6 or later, one can also write a shouldPerformSegueWithIdentifier method which can apply conditional logic to determine whether a particular segue should be performed or not.

To programmatically perform a segue, the performSegueWithIdentifier method may be invoked.

References

Related tags

1557 questions
100
votes
3 answers

Does anyone know what the new Exit icon is used for when editing storyboards using Xcode 4.5?

Right-clicking the Exit icon yields an empty window. Can't Ctrl-drag a connection to any IB elements or corresponding source files. Docs give no love. Doesn't appear in nib files, only storyboards. My assumption is that it's a corollary to segues,…
rsswtmr
  • 1,776
  • 5
  • 16
  • 26
77
votes
18 answers

Warning: Attempt to present * on * which is already presenting (null)

This is my first application for iOS. So I have a UIVIewController with a UITableView where I have integrated a UISearchBar and a UISearchController in order to filter TableCells to display override func viewDidLoad() { menuBar.delegate = self …
Splendf
  • 1,611
  • 1
  • 10
  • 8
71
votes
14 answers

Instead of push segue how to replace view controller (or remove from navigation stack)?

I have a small iPhone app, which uses a navigation controller to display 3 views (here fullscreen): First it displays a list of social networks (Facebook, Google+, etc.): Then it displays an OAuth dialog asking for credentials: And (after that,…
Alexander Farber
  • 21,519
  • 75
  • 241
  • 416
66
votes
10 answers

Prepare for Segue in Swift

I'm facing the error message: "UIStoryboardSegue does not have a member named 'identifier'" Here's the code causing the error if (segue.identifier == "Load View") { // pass data to next view } On Obj-C it's fine using like this: if…
ndraniko
  • 814
  • 1
  • 8
  • 14
63
votes
11 answers

How do I do a Fade/No transition between view controllers

Is it possible to do a fade in and fade out transition between View Controllers in Storyboard. Or without transition. If it's possible, what's the code for it?
Sjors
  • 781
  • 1
  • 6
  • 6
44
votes
4 answers

Storyboard Segue Identifier naming conventions

I'm building a large storyboard and I was wondering if anyone has come up with helpful naming conventions for segue identifiers. It looks like Apple just uses 'ShowX' in their examples where X is the name of the view it is showing. So far I prefer…
Steve Moser
  • 7,647
  • 5
  • 55
  • 94
39
votes
3 answers

To stop segue and show alert

Using iOS 5 storyboards, on a button I am performing a segue, what I want is to do validation on my textfield and if validation is failed I have to stop segue and throw an alert. Whats the way to do it?
Firdous
  • 4,624
  • 13
  • 41
  • 80
37
votes
9 answers

How to check if a view controller can perform a segue

This might be a very simple question but didn't yield any results when searching for it so here it is... I am trying to work out a way to check if a certain view controller can perform a segue with identifier XYZ before calling the…
Rog
  • 18,602
  • 6
  • 76
  • 97
34
votes
2 answers

Difference between a custom UIStoryboardSegue and UIViewController transition

I am trying to find out what the difference is between a custom UIStoryboardSegue and a custom UIViewcontroller transition (introduced in ios7). What are the differences and different use cases for both? As far as I can tell they are both used for…
StuartM
  • 6,743
  • 18
  • 84
  • 160
33
votes
8 answers

NSInvalidArgumentException - receiver has no segue with identifier

I have been trying everything for hours, and nothing's worked. I am trying to segue between two view controllers, from one tableViewController to another tableViewController. The segue is hooked up to the top level view, not the tableviewcell. The…
32
votes
5 answers

How to execute some code after a segue is done?

Is it possible in iOS 6 to know when a UIStoryboardSegue has finished its transition? Like when i add a UIStoryboardSegue from UIButton to push another UIViewController on the navigationcontroler, i want to to something right after the…
bogen
  • 9,954
  • 9
  • 50
  • 89
28
votes
11 answers

'Show' segue in Xcode 6 presents the viewcontroller as a modal in iOS 7

I have two view controllers in my iPhone application (built with swift) built with Xcode 6.1 and uses storyboards. The first view controller is embedded in a navigation controller in the storyboard and the segue for the second view controller is a…
momentsnapper
  • 605
  • 1
  • 5
  • 11
28
votes
10 answers

prepareForSegue is not getting called when I click on a button without using performSegueWithIdentifier

Based on the Stanford iOS course I am playing with modal view controllers. In the demo they have a button that would launch a modal view and when it is clicked the function prepareForSegue is called. I mimicked the code and implementation into my…
Amro Younes
  • 1,261
  • 2
  • 16
  • 34
27
votes
7 answers

Passing Data between View Controllers in Swift

I am trying to convert an app from Objective-C to Swift but I can't find how to pass data between views using Swift. My Objective-C code is UIStoryboard *storyBoard = [UIStoryboard storyboardWithName:@"Main" bundle:nil]; AnsViewController…
lagoon
  • 6,417
  • 6
  • 23
  • 30
24
votes
1 answer

How do I create a segue that can be called from a button that is created programmatically?

In Swift I have a button created programmaticaly using: var button = UIBarButtonItem(title: "Tableau", style: .Plain, target: self, action: "tabBarTableauClicked") I want that when the user clicks the button it changes viewControllers. Here is the…
Clément Bisaillon
  • 5,037
  • 8
  • 32
  • 53
1
2 3
99 100