XCode 7 Storyboard segue usage confusion - ios

I'm trying to make segue using storyboard, and I found it's really confusing for me. Sometimes, when I drag and drop segue push or modal, both will act like modal (bottom to up). And sometimes, it will act like push (right to left). I'm also using navigation controller to handle the right and left button. Do you know why it happens? How do we make sure that if we want to View Controller to animate right and left, we use push. and if we want to use modal, the View Controller to animate bottom to top. Thank you guys!

Check you are using the correct type of segue -->
On the right hand side, after selecting the segue -->

Related

Changing the animation for unwind segue

My client wanted a navigation drawer (hamburger menu) on the top-left corner of the navigation bar (yes, they know it's not adherent to the iOS design principles, but they want regardless).
I have the hamburger setup as a custom icon with a segue that pushes to the menu viewcontroller (MenuViewController)
The problem was the client said it slid out from the right, and closes to the left (which is standard with Apple). They want to reverse it.
So I need to reverse both animations (slide in, and slide out)
To do the first part, I followed this, which worked perfectly:
iOS Segue - Left to Right -
So now after applying that custom code it slides in beautifully from the left.
But now I want the drawer to slide back to the left, but of course by default it goes to the right when I click the < navigation arrow on the top of MenuViewController.
Any ideas how I could go about reversing this? I was thinking custom unwind segue, but I don't actually HAVE a segue on the storyboard because this is just a back button being generated as a result of pushing the MenuViewController to the navigation stack.
My guess is to create some sort of override for unwind on the MenuViewController.swift file, but I haven't had success so far.
Could anyone point me in the right direction?
Thanks!

For swift iOS app dev, how do I segue to a view that takes up part of the screen only?

GroupMe is a good example. I want to implement something similar to this..
when you press the top left icon it'll bring you to the view on the left hand side, and when you click the right hand side of that view (the chats) it will bring you back
As the documentation says:
Use segues to define the flow of your app’s interface. A segue defines
a transition between two view controllers in your app’s storyboard
file. The starting point of a segue is the button, table row, or
gesture recognizer that initiates the segue. The end point of a segue
is the view controller you want to display. A segue always presents a
new view controller, but you can also use an unwind segue to dismiss a
view controller.
As said by Apple© segues are for changing View Controllers only and cannot be used to move single views. I suggest using animations to achieve the effect you are searching, however segues are definitely not what you are looking for. Maybe this question on stackoverflow.com may help you.
And please be sure to check for information by yourself first, I got this information in less than 5 minutes by searching on Google.com.
Regards -Jorge

Proper way to segue between two simple View Controllers in iOS 7

I'm mainly from a C# background, so the workflow for iOS is a bit unusual for me, at least for now.
I was having a problem having simple segue from a main menu, to a another menu/work area, and then with the ability to go back to the main menu.
For a test, apparently I did something wrong.
I didn't write any code for this test to exhibit the problem.
What I did was just,
create a new single-view app
drag an additional view controller onto the work area
drag the start arrow to the new view controller (so it becomes the initial view, same thing as checking the checkbox to set it as the initial view)
added a button to each view controller
Ctrl + clicked and dragged the buttons to the opposing view
for the segue type, I chose "replace"
now the program crashes if I hit the second button to go back to the "main menu" (green view controller in this example)
So what am I doing wrong? Do I need to add some form of delegate or something?
I did find this, though it present fewer segue options in the tutorial than what I have.
https://developer.apple.com/library/ios/referencelibrary/GettingStarted/RoadMapiOS/SecondTutorial.html
These are the options I have when I Ctrl + Click from a button to another view
-Push
-Modal
-PopOver
-Custom
-Replace
"Have you embedded a navigation controller? You need to go to editor->embed in-> Navigation Controller. You need a navigation controller for push segue. – Kaushal Bisht"
This solved it for me. Now I'm just going to work on replacing the navigation bar with custom UI controls.
Thanks everyone! :)

Tabbar not showing in ios application

i am making one iOS tabbar application in that i have put 4 different tabs and whenever i click on 1 st tab and load another view after clicking of the first tab. After that when i press back button then tabbar is not displaying .So that i want hint that how can i show that
back the tabbar when we move from one tab from another and yes how i can use consistent the tabbar in whole application can you just guys help me on this i am new to iOS development.
here i am put the screen shot ...
here first screen is this one..
when i tap the video button that are first in the view then another window open
which are as under and see the tabbar is not there...
when in video controller there is tabbar is there but i drag and connect to that then tabbar is disabled
Looking at your screen snapshots, do I correctly assume you're attempting to transition to the "Videos" scene by touching the big "Videos" button in the center of the "Home" scene (rather than touching the tab bar button at the bottom of the screen, which I assume works fine)? If that's the case, you need to have your button tell the view controller's tab bar controller that you want to change the index of the tab bar, and it takes care of it for you. You cannot do the transition using a segue (or at least not without a custom segue, which is even more complicated than the procedure I outline below). If you're changing the view some other way (e.g. using a standard segue or using presentViewController, pushViewController programmatically, etc.), your tab bar can disappear on you.
You later said:
when in video controller there is tabbar is there but i drag and connect to that then tabbar is disabled
Yes, that's true. You cannot use a segue from one of your big buttons to one of the tabs in your tab bar. (Or technically, if you wanted to use a segue, it would be a custom segue which would do something very much like my below code, though perhaps a tad more complicated.) So, rather than using a segue for your big button, you need to write an IBAction (connected to the big Videos button on the Home scene), that tells the tab bar to change its selection:
- (IBAction)clickedVideosButton:(id)sender
{
[self.tabBarController setSelectedIndex:1];
}
A couple of comments:
My answer was predicated on the assumption that your tab bar works as expected when you tap on the buttons of the tab bar, itself. If you tap the buttons at the bottom of the screen, do you transition to your other views correctly and preserve the tab bar? If so, my answer above should solve your issues in getting the big buttons to work. If not, though, then the problem rests elsewhere and you need to show us your code that might account for that (either you're something non-standard in the UITabBarControllerDelegate methods, or your viewDidLoad of the view is doing something nonstandard).
If I understand your user interface design right, you have the tab bar at the bottom as well as the big buttons in the middle, which presumably do the same thing. That is, no offense, a curious user interface design (duplicative buttons, requiring extra tap on a button, etc.). You might want to choose to either use either big buttons (in which you can retire the tab bar, eliminate the IBAction code I've provided above, and just use a nice simple navigation controller and push segues, for example), or just use the tab bar (and lose the home screen, lose the big buttons, etc.).
You also made reference to "press back button", and I don't see any "back" button on any of your screen snapshots. Do I infer that you have a navigation controller and you're doing a pushViewController or push segue somewhere? If you're doing something with back buttons, you might need to clarify your question further.

How can I change the Storyboard animation for modal in Xcode 4.2?

I am quite new to Xcode coding and I have been using Storyboard for along time, if you know when you link a button to a view and select the option "Modal" it will make a link with the animation of the new view coming up from the bottom. I was wondering if it was possible to change the animation to the new view coming from the right. I am sorry this question was so brief, if you need more info just ask me.
Thanks.
If you select the segue and look at the Attributes Inspector (on the right side of the window), you will see a pop-up menu labeled Transition. This menu lists the available transition styles for the segue:
Cover Vertical
Flip Horizontal
Cross Dissolve
Partial Curl
If you want a different style of transition, you will need to use a different type of segue. If you have a UINavigationController hosting your source view controller (the one that contains the button), you can use a Push segue, which slides the new view in from the right. If you don't have a navigation controller or don't like the Push segue animation, you'll have to implement a custom segue to change the animation.
More on custom segues
Custom Segue- Apple
Custom Segue + CATransition
-anoop

Resources