I am creating an app that uses UIWebViews and was wondering if it is possible to open a link that the user clicks in the original webview in a different view?
You can't have UIWebView do that automatically for you, but here's a rough outline of what to implement if you need one:
Intercept the link in shouldStartLoadWithRequest: and keep it somewhere.
Do a return NO; to prevent the link from loading inline.
Open the new view (if it doesn't already exist).
Inject the link from (1) in the UIWebView inside the other view using loadRequest:
Related
I am very new to xcode, got stuck in finding the editor to modify the code when created multiple view controllers. Whenever I click on any of the view controllers, I only see same editor contents and cant move to the others for coding.
I searched the web and stackoverflow but could not find a clear guideline on how to manage the editors for multiple view contollers. I have attached a snapshot.
You don’t “find” code. You create it.
When you drag a view controller into the storyboard, it has the default class of UIViewController. It is up to you to make a new code file where you subclass UIViewController, and then to go back to your storyboard and change the view controller to that subclass in the Identity inspector.
The documentation just isn't helping me figure out what to do. I'm using Swift 4 and here is what I want to be able to do
When user hits the Save/Export button, save the photo to the photo
library
In code, hold onto that image and pass it back to another
view controller
I can't find in your documentation for iOS/Swift exactly how that image is held, what UIIMage or UIIMageView is pointing to it? If you can answer with some specific code that would be very helpful.
I can't see purchasing or licensing your product without this assistance
To do either of your points, you can register the view controller that presents the PhotoEditor SDKs PhotoEditViewController as the editors delegate. Afterwards, the editor will notify your view controller upon export via the photoEditViewController(_:didSave:and:) method described in our docs.
The exported image is passed within the image argument and you can do whatever you want with it. Either save it to the iOS library or pass it around your app hierarchy.
I hope this clears things up for you!
I'm working on the app that displays svg icons inside NSCollectionView. I want to implement drag&drop feature to allow users drags svg to Finder or another app. There are I have two questions:
1.) To implement drag to another app I'm using NSFilenamesPboardType for registerForDraggedTypes and in collectionView:writeItemsAtIndexes:toPasteboard: create temp file and write it URL to [pasteboard writeObjects:#[fileURL]]; because collectionView:namesOfPromisedFilesDroppedAtDestination:forDraggedItemsAtIndexes:not called in this case. Is it correct implementation? I cannot find how to implement drag&drop for svg in another way.
2.) How I can receive callback that drop ended? NSTableView in data source has method tableView:draggingSession:endedAtPoint:operation which determines end of drag. For NSCollectionView this method not documented, but exist in NSCollectionViewDelegate. Can I use it and app will pass the review?
Thanks for any advice
There is an NSCollectionViewDelegate method that was available with 10.7:
- collectionView:draggingSession:endedAtPoint:dragOperation:
It calls the method AFTER the item is dropped to receiving application.
collectionView:namesOfPromisedFilesDroppedAtDestination:forDraggedItemsAtIndexes: will be called if you use NSFilesPromisePboardType. You create the files after the drop. If the other application doesn't accept promised files, this won't work.
It looks like Apple forgot to add the new drag and drop delegate methods of 10.7 to the documentation of NSCollectionViewDelegate. You can use them.
I am a complete newbie in Mac development. I want to achieve the following functionality :-
I have a view with a two textfields and a login button.When the user clicks on login button another view should open.
Now my main view is in MainWindow.xib file..
I added another view using
Add-> New File-> Xamarin.Mac-> Cocoa View with controller, which generated the following files:-
1.) NewView.cs
2.) NewView.xib
3.) NewViewController.cs
After searching quite a lot on net i did not get the exact way to achieve this functionality. I referred this thread
Easy Switching of "View Controllers" in Mac Apps (similar to iOS)
but could not get the much out of it. Can someone tell me how to simply navigate from one view controller to another using Xamarin.Mac and where what code is to be written??
Any links,code snippet or sample code will be of great help!!
Thanks a ton in advance!
Here is the answer :-
If you want to switch from one view to another below code snippet shows how to add and remove views:-
Write the below two lines in your Action of login button.
Previous view will be removed and new view i.e SecondView will be added.
this.View.Superview.AddSubview(new SecondViewController().View);
this.View.RemoveFromSuperview();
Cheers!!
I'm very new to RCP and I want to build a window with a TreeViewer as a menu on the left and views on the right.
When clicking on a TreeItem the current view should be replaced with the new page.
The Views shall not be moveable or closeable.
The menu works fine so far but I can't get the views to act like I want.
I tried using a Placeholder within my perspective:
layout.addStandaloneViewPlaceholder("gui.page:*", IPageLayout.TOP, 0.5f, editorArea, false);
The IDs of the views all start with gui.page...
When I add one of the pages as standaloneView to the perspective it looks just as I want it.
But when I add a View by calling
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(pageID);
in the listener of the TreeViewer, the Pages get tabbed and are move- and closeable.
A good example of what I want to have is the preferences dialog of eclipse. I searched in the eclipse source but I couldn't find the way they made it.
Any suggestions on how to make this?
Views won't get replaced. So you have to hide the previous view by calling IWorkbenchPage.hideView()