I have a bunch of views (5) and a navigation controller the user can go through by pressing buttons that segue to the next view (each view has something the user does and sends data to the next one). My app is connected with a Firebase database, so I'm doing some stuff with that.
Anyway, the view I can't get to work is a TableViewController which works as a checklist, the user must select a certain number of cells, then clicks next and an array is sent through the prepareForSegue to the next view and this view should be display. It isn't. I have some code and some prints in the viewDidLoad that let met know that the view is supposedly loading, just not being displayed.
The screen freezes and the button just remains pressed. It doesn't crash, just stops.
My code has nothing special. It just has a performSegue in the first view and nothing really in the second one.
This is the way they're set up:
https://imgur.com/a/cyO47Pl
I've been told the problem is that there are too many push segues or something like that, could it be?
Related
I have an iPad UI set up that different views are loaded into a container view on a button press.
Most of these views have 1 or 2 table views in them
When I try to press on the cells in the table views it is very slow and sometimes I have to press for 6/7 seconds before it will call the didSelectRowAt function.
One of these tables also has a custom cell, with 2 buttons. Only the very right portion of one of these buttons is visible, the rest of the button is hidden, however still calling the touchUpInside events.
Does anyone know how to fix these issues?
This is hard to explain but i'll try my best. I have a Table View controller that leads to 10 View controller. All the View controllers have a navigation bar title (The titles are the 10 objects from the Table view controller). Now i want to add the Swipe Gesture for a easier navigation between the 10 table view items (Instead of going back to the Table view manually i want the user to be able to swipe to change from a view controller to another). HERE'S THE PROBLEM: When i add the Swipe Gesture and i connect it from one view to another, it asks if i want the action to be either: Push, Modal or custom. Now, if i choose one of them, it makes the navigation bar title disappear. I want to keep the title without messing up the connection from the table view to the views controller. Thanks.
You want a pageviewcontroller. Set up the pages to be your different view controllers
A pageviewcontroller essentially allows you to do exactly what you want to do without having to setup a new segue every single time. That way it can all happen under one navigation bar. If you've seen the twitter app, you know how you can scroll through your feeds? Same thing.
There are tons of tutorials on the web, but pageviewcontroller a can be a tiny bit tricky because they require some logic
Here's a slightly more advanced thing that might be useful to you:
https://github.com/cwRichardKim/RKSwipeBetweenViewControllers
I have seven views that I need to navigate between from any of the other views. I don't want to keep doing segues from each one as new instances would keep being created...among other issues. What I was originally trying to do was have all the segues start from a home view and then go to the designated target view. When the user left that target view a public variable would be set if they wanted to go to any other view other than the home view. When the home view reappeared, it would check that public variable to see if another jump was needed. In the Home view I put the segue jump check in the -(void)viewDidAppear:(BOOL)animated function. The problem with this being you see the home screen for a second before it goes off to the new target view. The -(void)viewWillAppear:(BOOL)animated does not work for segues. I guess this is because it hasn't fully released the old segue yet?
Is there a better way to handle a freeform many view navigation issue like this? If anyone needs it, I can post some sample code for what I was trying to do. Thanks in advance for any help.
It sounds like you need a UITabBarController.
It allows you to have multiple view controllers, and switch between them by tapping the tab on the bottom of the screen.
It allows you to have only one instance of each controller, so that as you switch between them, data persists and you aren't creating new instances each time.
Here is an example of what one looks like (notice the tabs at the bottom of the screen):
(source: xamarin.com)
Summery:
I have a custom UITabBarAutoRotateController which returns YES from shouldAutorotateToInterfaceOrientation. This has no effect.
If I minimize and show the app again, the rotation issue goes away.
How do I refresh the screen so the user does not have to do this (so rotation works again)?
Details (setup graphically, so no code):
I have two UITabBarController in MainWindow.xib. I only want one to show at a time. So I am linking graphically rootViewController = tabBarController_name1. There is also tabBarController_name2.
I will also have an alert MessageBox for a user to choose what type of application they need, and it will choose a tab bar controller based on their request (per customer definition). This is commented out for now.
There is a bug with Rotation when two UITabBarControllers exist on the same xib. When I try to rotate the screen, it stays upward with wherever the main screen button (power button looking button) faces. HandleOrientationChange does not get called on the active custom ViewController being shown.
The reason I believe it's a bug is because if I hit the main screen button (minimizing the application), and click back on the application (brings it back to the foreground), rotation works perfectly!
Sorry for making you read all that mumbo :). My true question is, "Is there anyway I could refresh the main window or likewise UITabBarController's to get rotation working (without requiring the program be minimized and shown)"? A work-around, if you will?
p.s. I cannot use Storyboard for backwards compatibility reasons. The customer will be receiving this code/project. So I would like to keep this in one graphical page, rather than hiding/showing UITabBarItem's.
EDIT: two-uitabbarcontrollers-and-autorotation and uitabbarcontrollers-and-uinavigationcontrollers were both helpful, but did not address "why" this issue happens. "noob" here when it comes to xcode :)
Tab bar controller inside a navigation controller, or sharing a navigation root view is the answer. Do not use a TabBarViewController. Which, as a noob, I'm not quite sure why TabBarViewController exists (or at least isn't depreciated).
Dragging two TabBarViewControllers into the same page should result in a warning saying that you probably want to implement TabBarViewController by making a custom UIViewController and attaching a plain UITabBar to it.
Frustrating...but finally making progress :)
I got an application which has a NSToolbar in its main window. Depending on which icon is clicked a NSView is displayed in this window. My problem is, that one of these views shows data in a NSTableView that I want to be reloaded each time the view is visible. Since -init is only called once, I don't know how to do that.
(example: When the application starts it shows the Documents section [on of the sub views of the window]. Now when I click on Employees [which displays another sub view instead of the first one] and then on Documents again, I want the data in Documents' NSTableView to reload.)
How do I do that?
Thanks in advance.
I got an application which has a NSToolbar in its main window. Depending on which icon is clicked a NSView is displayed in this window.
Use a tab view. You can hide the tabs, then implement your action methods for the toolbar items to act as the tabs, changing the selected tab view item to whichever one corresponds to the pressed toolbar item.
Now when I click on Employees [which displays another sub view instead of the first one] and then on Documents again, I want the data in Documents' NSTableView to reload.
Why? Why not reload it only when the data changes?
You don't have to hold NSTableView's hand; if it needs the data from you again, it'll ask you for it again.
And if you're concerned about reloading the data while the view is not visible, that's premature optimization. Don't worry about it until you prove via profiling that it is a real performance problem.