The iPad app that I'm working on makes use of Storyboards and segues. I'm trying to display a different view controller when the user clicks on different cells in the master view.
After referring to different tutorials, the steps that were taken were -
In the Storyboard, Master View Controller, created static cells for the table view and added 3 different rows (i.e. cell 1, cell 2, cell 3)
Added a View Controller, selected it and attached a Navigation Controller to it (Editor -> Embed In -> Navigation Controller)
From cell 1 in Master View, I did a ctrl-click on the Navigation Controller.
Chose Segue Style "Replace" and Destination "Detail Split"
In tableView:didSelectRowAtIndexPath, added [self performSegueWithIdentifier:#"NewViewController" sender:self] to do the transition.
The result that I see is the detail view gets replaced.
But the navigation bar does not have the bar button item Master.
So I'm unable to click the Master button which would show the table containing cells from where I can navigate to a different view.
I've already read many blogs and seen commentary which talk about replacing a segue for similar problems. However nobody seems to have faced this specific issue while using storyboards and segues.
From my understanding using segues should help me achieve what I want. From those who have tried this approach, any pointers in the right direction will be helpful.
Try changing the Segue Style from Replace to Push. It should resolve your problem.
When you push a UIViewController on a UINavigationController, it will be added to a stack and you will be able to navigate back :
Your navigation controller stack before tapping "Detail":
Master
Your navigation controller after tapping detail and navigating a little more ...:
Master -> Detail (Navigation button is displayed) -> Some other details (Navigation button is displayed) -> And maybe some more (Navigation button is displayed)
When you call a new segue using Replace like you did, the Master will be replaced with Detail, and you will not be able to navigate back because Master was replaced and it's not on the stack anymore.
Your navigation controller stack before tapping "Detail":
Master
Your navigation controller after tapping detail using replace like you did:
Detail (no navigation button because master was replaced and we don't have nothing more on the stack)
Related
I have a web app layout like below screenshot.
It has several menus, and in each menu we have several tabs on the left sidebar:
if some configuration in one tab is wrong, I want to get notified even i was opening another tab.
Currently for each tabs, i have 1 service map to it, e.g. tab1 -> tab1Service, tab2 -> tab2Service.
Each service will have an init method to initial the data for each tab(tabCtrl), and it will only be called once i click that tab.
So here is the question:
If i want to got notified which tab has an error when i first go into this menu, i have to call that tabService init in the parent controller also, otherwise the error icon won't be displayed.
If i am going to do like this, once i refresh the page on a sub tab, the init method will be call twice consecutively, which isn't very good.
Does anyone know is there a better solution for this? I think it should be a common case in web development, hope someone could help me on this.
I am using custom Directive's approach in AngularJS for making dashboard with widgets and for widgets m using angular-gridster
(https://github.com/ManifestWebDesign/angular-gridster).
Requirements:
On right side menu created by custom directive is present.and for routing purpose UI Router in used.
1-I need to open a dashboard firstly empty.
2-when click to Menu1 one widget is opened with data from state menu1 and same for Menu2
3-when 2nd option is clicked another widget added to dashboard without affecting previously opened one and so on.
4-all the widgets have independent data.and navigation in each widget is according to the respective menu.
WorkFlow:
1-empty dashboard is opened via custom directive.
2-widgets are added by providing click event to menu1 and menu2.which will broadcast event.and against that click event a widget is added to widgets array holding information about that widget.
Problem:
problem is routing basically.till now there is no routing involved.info is passed by broadcasting a click event.and by this i have achieved this coloured area.
but the further navigation creates problem.when a state changes by clicking Menu1 or Menu2 it affects both the widgets and and ui-view portion in both widgets show same data.if Menu1 is clicked both widgets show data from Menu1 and vice versa.
Now.i have tried enough solutions but here i want an idea from ui router experts or custom directives' experts.cz i hv tried many possible ways and stuck here for almost a week.
Thanx very very much if anyone can help.
I have an app with a Sidebar, which is its own module with its own region, and a primaryRegion that can show views from two other modules (a Dashboard view or a Detail view of an item selected from the sidebar).
When an item gets clicked in the Sidebar, it changes its display to show that it's been selected and gets displayed in the primaryRegion.
The problem I'm running into is that I've recently added routes to the app to directly display item details in the primaryRegion and I can't maintain this behavior when going directly to the Detail view for a given item.
Given that only one module can respond to a route, how can I get the Sidebar to select the item designated in the URL and also display that item's Detail view in the primaryRegion without using a global object or introducing race conditions?
Apologies for the lack of code, I'm having a hard time reducing it down to the essential parts while keeping it clear. Hopefully my description is good enough but if not please let me know and I'll provide more detail.
I can think of two options you could try:
Have Detail fire a global event when it renders, and have the Sidebar be listening for that event and highlight the correct item based on the data it gets from that event.
Or have your Sidebar handle the routing and use a variable route to determine what Detail to render. For example, have a route in the Sidebar of 'details/:id': showDetails' and then a function like:
-
showDetails: function(id) {
// highlight item with id === id here
this.primaryRegion.show(new Details(id));
}
We're developing a simple app with the sencha framework
The app consist of a few tabs( a tabPanle with bottom tabBar) and the switching between tabs works perfectly when we use it as it is on the sencha docs, alas when no live data is present.
When we add stores within the single tabs, functionalities breaks, tabs stop switching and every time one clicks a tab to change the view, a flickering appears, the default tab is loaded again(from the chrome console we can see that all the remote data request of the loginView get reissued) and the only tab that remain visible to the user is tab[0].
app.js --> http://pastebin.com/S9qaNfij
mainView.js ---> http://pastebin.com/uiG2E0AW
controller.js ---> http://pastebin.com/8MTfxC85
This was created with senchaArchitect, that btw is awful and quite useless if not to work visually with the components.
here is a little movie of the thing happaning.
http://youtu.be/OVOSOWhMZeE
What are we doing wrong?
I think it's your button listener, it seems that it might be being triggered on even the tab panel button taps. I would try giving your button a unique ID and then create a ref and an action to login based on that ID.
I am new to iOS programming. I am quite amazed at the power and ease of collection view. But I have a problem.
I have a "home" view controller - A, which is UICollectionViewController. I have a left button (like Facebook on the navigation bar) and I redirect to another view controller using
[self.navigationController pushViewController:controller animated:YES];
When the user presses the back button, the "home" view controller appears. And viewWillAppear and other collection view delegate/datasource methods are called. but table is frozen. It does not scroll, do anything.
But if on the left button i press the "home" button, then viewWillLoad and other methods are called and the collection view works.
I do not have any code in viewWillLoad. I have moved everything to viewWillAppear to test.
Please help