John-Lluch / SWRevealViewController

A UIViewController subclass for presenting side view controllers inspired on the FaceBook and Wunderlist apps, done right !
Other
4.52k stars 988 forks source link

How to recall UIViewController without reload data #609

Open hprobotic opened 8 years ago

hprobotic commented 8 years ago

Hi

I have 3 view already open with name: View A, View B and View C For example: User working on View A, after done, move to view B for completed some step but if i use revealViewController for push View B from current view (View A), View B alway be reload and break user workflow

iDevelopper commented 8 years ago

Why do not push view B with a navigation controller, if one exist, or presentViewController?

hprobotic commented 8 years ago

Can i presentViewController B without losing navigation bar in View B?

I tired it before but it will just load Single View B without load SW Navigation bar

iDevelopper commented 8 years ago

If view controller A is in a navigation controller push the view controller B with it and you will have a back button to come back.

hprobotic commented 8 years ago

Ahh, we have some confused here

As i has been explain: I have 3 view controller A (Create Poll), B (List Poll), C.

When i press Done Button on View A (Creat Poll), i want present View B (List Poll) immediately.

Here is what i did

func onDonePressed(sender: UIButton!) {
            let votePollViewController = PollListViewController(queryType: PollListQuery.All)
            let navigationViewController = UINavigationController(rootViewController: votePollViewController)
            self.revealViewController().pushFrontViewController(navigationViewController, animated: true)
}

But this code will be reload view B like when we press button to call view B on Side Menu

iDevelopper commented 8 years ago

Yes you replace the front view controller A by a new B

hprobotic commented 8 years ago

Hi Thanks you. Can you give me an example?

iDevelopper commented 8 years ago

Yes if you tell me what you want to do exactly! If you want recall B without reload datas, you have to save it in a variable and not allocate it each time.

hprobotic commented 8 years ago

Hi Here is GIF version: http://imgur.com/CiI7UZE I want present View B (List Poll) without reload data for collection view when i press Done in View A (Create Poll) Currently, whenever i call View B, it will reload all data from Server

iDevelopper commented 8 years ago

If you want recall B without reload datas, you have to save it in a variable the first time you create it and not allocate it each time.

let votePollViewController = PollListViewController(queryType: PollListQuery.All) create a new instance of the controller!

iDevelopper commented 8 years ago

Have a look at this sample:

You will see that mapController1 and mapController2 are saved in two variables in MenuTableViewController, and in didSelectRow, i test if they are already existing.

MapSample.zip

hprobotic commented 8 years ago

Wow, looking on your example, it work like charm, thanks

iDevelopper commented 8 years ago

Welcome!

If you are interested by menus on top I wrote another library inspired from SW (SW is no longer maintained I think, as John does not respond to the issues anymore).

When I saw your gif, I thought this could be a good test!

https://github.com/iDevelopper/PBRevealViewController

hprobotic commented 8 years ago

Ok, sure Just take a look and started your project few minutes ago. Can you give me your facebook id or skype for further discuss 💃

iDevelopper commented 8 years ago

I would prefer mails as I don't use FB a lot!

patrick.bodet4@wanadoo.fr