I need to move between the xib/nib files using UIButton
s but I can't connect the buttons, is there a certain way to do it in if I'm connecting two xib/nib files?

- 415,655
- 72
- 787
- 1,044

- 31
- 5
-
When I control-drag to the xib file It doesn't give me the menu where i can select which segue to use – Shakespear123 2 Jul 15 '16 at 21:41
-
how would i do that? – Shakespear123 2 Jul 15 '16 at 21:56
-
Thanks I will try it and update you – Shakespear123 2 Jul 15 '16 at 22:55
-
Sorry to bother you but i have another question whenever i try to load my app on an iPhone i get a debugger message which says "Terminated due to memory issues" however i have more than enough space on both the iPhone and the computer what may be the problem? – Shakespear123 2 Jul 15 '16 at 23:40
-
Also i have no problem running the program on the simulator, it is only problematic on the iPhone – Shakespear123 2 Jul 16 '16 at 00:11
-
Regarding problems running app on device, one possible problem is that macOS is not generally case sensitive, but iOS is, so check the capitalization of your NIB/XIB names. If that's not it, I'd remove the app and reinstall it, as sometimes Xcode gets confused and won't install everything. – Rob Jul 16 '16 at 01:28
-
If you don't mind i have another question. how can I programatically move between xib files? or can i connect a segue to a xib file for example go from a view controller to the end of the swipe navigation? thanks in advance – Shakespear123 2 Jul 23 '16 at 10:42
-
Is there any way to use a custom segue between xib? – Shakespear123 2 Sep 07 '16 at 22:16
-
Could i use the animation in any way? Or could i use a command to move to a certain xib? – Shakespear123 2 Sep 08 '16 at 04:23
-
When I use showViewController I Get to the xib but I can't swipe left or right anymore. How do i fix this? Thanks in advance – Shakespear123 2 Sep 20 '16 at 13:59
-
I haven't done anything yet I´m not sure what I could share. Like I said before I tried what you suggested however that left me unable to swipe left and right – Shakespear123 2 Sep 20 '16 at 16:37
-
Excuse me but i have another question. Could make my swipe navigation controller begin at a certain xib file? I have tried what you suggested before and that hasn't worked – Shakespear123 2 Sep 20 '16 at 20:09
-
See example of how to hook up `@IBAction` to swipe gesture below. – Rob Sep 20 '16 at 23:26
1 Answers
You cannot use segues in NIB/XIBs. To transition from one NIB-based view controller to another, you have to hook up the button to an @IBAction
which programmatically transitions to the next view controller. So open up the NIB, choose the assistant editor, and control-drag from the button down the the code and create @IBOutlet
that performs the @IBAction
:
And in that @IBAction
, write the code to programmatically transition to the other NIB (in this case, I'm calling a routine that pushes to the next view controller using the navigation controller).
For swipe gestures, the idea is largely the same. First, drag a swipe gesture from the object library onto the view:
Then control-drag from the swipe gesture to your code in the assistant editor, specify that it's an "action", and then write the code to transition to the next scene:
Note, if you want to make your swipe gestures interactive (i.e. that the transition is coordinated with the user's gesture, allowing them to pause, complete, or cancel the gesture), it's more complicated, but can be done. But I'd suggest you master the simple UISwipeGestureRecognizer
first. But if and when you get there, see a discussion of interactive custom transitions with navigation controller gestures or interactive custom presentation transitions.