UIActivity view controller in Swift - uiactivityviewcontroller

I want to use UIActivity view controller,When i click on sharing button then share sheet open...
I want to make a separate UIActivity controller class using callBack method.and how we use in another view controller class

Related

Angularjs two separate ui elements communicating

I have a use case to toggle the view of a form using a button. The button is not nested in the same structure of the form, and is out side the scope of the forms controller.
What is the best way to have this toggle button comunicate to the contents controller to display this content?
I have had a similar problem and for advanced comunications between controllers i would recomend a service. A service can be injected into multiple controllers so they can share information & state.
However if all your after is something like a button that you can place anywhere that will show the form, you could consider using the $location.path?
eg. on a view with a list of users
www.example.com/users
append edit
www.example.com/users/edit
then have the form controller watch the $location.path and open itself when it see's edit ?

Using a UIPageViewController with an embed segue

I'm working on a client project that uses UIPageViewControllers.
The app has a hierarchy of "collection" view controllers that the user navigates through to get to (in this case) a page view controller that contains pages of content.
My design is to have the hierarchy of "collection" view controllers be custom subclasses of UIViewController that know how to manage collections of child view controllers with the client's desired UI.
My view controller that displays a page view controller is a subclass of my parent collection view controller, and that parent view controller class might manage page view controllers, cover-flow style view controllers, table view controllers, or a variety of others.
Ok, so I can't make my view controller that manages a page view controller a subclass of both my parent view controller and of UIPageViewController.
This is an iOS 6 project, so I decided to make my view controller contain a page view controller using an embed segue. That handles the housekeeping of parent/child view controllers painlessly, or so I thought.
However, the client wants a page curl transition in the view controller, and it seems that you can't change the transition of a page view controller after initializing it, nor can you specify the navigation orientation, spine location, etc.
Hmm. Seems I am in a catch 22.
Does anybody know of a way to use an embed segue to embed a page view controller as a child of another view controller and control the settings you get with initWithTransitionStyle:navigationOrientation:options: ?
At this point I might need to abandon the embed segue and manage the parent/child view controller relationship manually, which is a fair amount of work, especially when you deal with forwarding auto-rotation and other messages from parent to child.
Ok, problem solved.
There ARE settings in IB for a UIPageViewController that let you control the transition style, navigation orientation, and options.
The problem is that when I created a container view in my parent view controller, IB created a generic UIViewController as the child and I changed it's type to UICollectionViewController. When I did that the settings stayed those for a generic UIViewController.
I had to delete the generic child UIViewController that IB created, drag a UIPageViewController scene into the storyboard, then control-drag from the collection view onto my new UIPageViewController and select "embed" as the type of segue I wanted. When I did THAT, it gave me the settings I needed.

Pushing a new view controller on iOS split view controller

I am using a splitviewcontroller template. From the detail view I am navigating to a different view controller using a SEGUE. The problem is the new view only displays in the detail view part of the split view. I want the new view to cover entire screen or a way to completely remove master view (when new view is pushed) and push master view back later. How can i do that ?
some code examples would be helpful.
You can implement this delegate method to conditionally hide the master view:
- (BOOL)splitViewController:(UISplitViewController *)svc shouldHideViewController (UIViewController *)vc inOrientation:(UIInterfaceOrientation)orientation
{
return YES;
}

Adding to a collection from a popup modal with Backbone Marionette

I'm pretty new to Backbone and Marionette and am having a tough time getting my views to communicate.
I've got a composite view that displays a list of items. To add a new item to the list, I have a popup modal that opens in a new item view that is separate from the composite view.
I'm not sure that this is the best way to do this, but in the modal, I created a new instance of the collection with all of the items and added the new item to that collection. This new item shows up in the original composite view, but only after I refresh the page.
I can't seem to figure out how to get the composite view to listen for the add event and render the new model after it is added.
Am I on the right track here? If not, what should I be doing to add to a collection from a modal?
I think I got this figured out. Instead of creating a new collection in the modal view, I passed in the collection from the composite view as a parameter when I created the modal view. Now, when I add a new model in the modal, the 'add' event is automatically triggered on both versions of the collection and the view automatically renders the new model. No need to bind any extra events like I was thinking.
Your solution will work, but means your views are pretty tightly coupled. You might want to look into using events instead (see How do I send a model that was clicked on within a ItemView to another ItemView that is on the same page?)
How your functionality would work with events:
Within the modal, you enter the data for the model to create
When you press the "save" button,
you validate and save the model var myNewModel = ...
you trigger an event: MyApp.MySubApp.trigger("item:add", myNewModel)
In the controllerfor the list view, you listen to that event, and add the new model to the collection.
The handler code in your controller would look something like:
MyApp.MySubApp.on("item:add", function(model){
this.myCollection.add(model);
});
If you'd like to learn more about using events, check out 2 Marionette tutorials I wrote:
http://davidsulc.com/blog/2012/04/15/a-simple-backbone-marionette-tutorial/
http://davidsulc.com/blog/2012/05/06/tutorial-a-full-backbone-marionette-application-part-1/
Both use events to communicate information within the apps.
In addition, basic events are also explained here: http://samples.leanpub.com/marionette-gentle-introduction-sample.pdf

How to pass variables from a controller to a view and vice versa in extjs4 MVC?

I need to pass some variables from a controller to its view or to another view. How can i do this in extjs4's MVC structure?
If you are creating a object of view from controller then pass that variable directly e.g. Ext.create('view.myview',{id:Ext.id(),myVariable:"someValue"});
and you can access it in view's initComponent method as
initComponent: function() { this.myVariable }
I recommend using Passive View, where the view has as little logic as possible.
Your controller can get access to any of the widgets in the view, via ComponentQuery. You can then write code in the controller to set or read values from the view.
You can also use the form.loadRecord() method to load a model into a view/form.
The widgets in the view communicate with the controller by raising events that are then handled by the controller.
You should load all of your controllers when the application starts.
Your controller should only have event handlers, and should never use the refs array or getView() functions (else you won't be able to control multiple instances of the same view).
Create and destroy your views at will. Pass in callback functions to communicate from parent to child view.

Resources