I have one SplitView controller which i have set in Application Delegate class.
Now I want to do that I want to hide Split view only in one particular view controller other wise it will be shown.
I know the method to hide split view but it will be hidden or shown in all the view controller how can i do that for particular one view Controller.
-Thanx in advance
Related
I have an application which has a single window controller and 2 view controllers.I have created a segue from a button within the main View Controller to the second View Controller;to show a modal window.
Is it possible to access the controls located within the second view controller by creating an outlet within the .swift file of the first view controller. i.e.:access controls within the second view controller from the first view controller.
What are you trying to achieve?
generally speaking - No. Button, labels, or view loaded by a view controller are only in scope (loaded into memory) when the view controller's view is displayed.
Very rarely would you need to initialize the view controller and make a method call before the view is displayed, so the real question is why are you wanting to do this.
Keep in mind its is called "view controller" i.e it controls the current views objects.
I believe there is flaw in your design by wanting to do this.
Making the assumption that the first view controller is not destroy when loading the second (i.e the second is a popup):
To properly communicate between the two view controllers you need two parts.
When performing the segue you need set parameter being passed to the second view controller.
https://developer.apple.com/documentation/appkit/nssegueperforming
Inorder to communicate back to first view controller you need to implement a delegate. I.e the second view controller delegates work back to the first:
https://developer.apple.com/library/content/documentation/Swift/Conceptual/Swift_Programming_Language/Protocols.html - view the section on delegation.
I am having trouble to find out the best way of transitioning only a part of view controller.
This is what I have:
In my first view controller, I have a UIView that acts like a header where I provide some ImageViews and Labels, bellow it I have a table view.
When user clicks a cell from the table, another view controller is pushed and it contains the same UIView header as before and bellow it some detailed information about the cell item selected.
This is what I want:
Since both view controllers have the same UIView header, I would like it to be fixed and only change the bottom contents (table view or detailed informations). I expect a transitioning effect that only move the contents on the bottom.
I appreciate any guidance.
A View controller controls views, so it isn't a case of transitioning view controllers, you can do this by transitioning views.
You can have multiple views. that occupy portions of the window.
In your case you could keep the top view (the one that you call the header) and when you need to change a part of the view your controller just needs to create a new view to display and then you can animate it into it's new position on top of the old view.
UIView animations let you accomplish this. For example, you could use transitionFromView:toView:duration:options:completion: to animate from your table view to the detail view.
It is possible to have a different view controller for this detail view if you want. All you need to do is create the view controller with the information that is needed to configure its view, and then pass this view as the toView to the above method, and then when you are done with the view, you can use the same method to transition back to the original tableview.
In my application, I have to present two modal view controllers one above the other.
Lets say Modal View Controller B is placed over Modal View Controller A. Sometimes, there will be only A and no B.
I want to check from A that whether the top Modal View Controller is B. I know there is a method NSStringFromClass() but I can apply that only if I get the top Modal View Controller.
use (BOOL)[[youObjectInstance isKindOfClass:[ControllerClassYouWantToCheckAgainst class]]
Documentation here:
https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Protocols/NSObject_Protocol/Reference/NSObject.html#//apple_ref/occ/intfm/NSObject/isKindOfClass:
In my navigation based application, first view is sign in or signup view. After that i am using a view which is using tab view controller. That view has three tab items. Now i want to create a new view and push in navigationController. But its not working. But adding new view as subView in tabBarController View works. I want navigation for subViews for each tabBarItem? How can i do that?
See this
In your case just create three items and make them all UINavigationControllers like the first tab item in the above example.
Let's have an example.
In application I have a tab bar controller.
Tab bar has two items dynamically - two view controllers.
User can select any of tab.
Suppose user selects first tab.
First view controller is already loaded.
Now he clicks on a button of First view controller.
From First View controller -> Second View controller is pushed.
Now when user taps on tab bar first item
second view is popped out.
This is done through by default by tab bar controller.
Now, If I want to check following condition
if(tab bar first item-view controller has first view controller view)
then perform this
if(tab bar first item-view controller has second view controller view)
then perform this
How to implement this logic?
If you are using a UITabBarController, you can use its selectedViewController property to know what kind of view controller is on the screen, so if you have two subclasses of view controller FirstViewController and SecondViewController you can say
if([[tabBarController.selectedVIewController isKindOfClass:[FirstViewController class]])
//... do something
else ...