Moving from one viewcontroller to another viewcontroller in Mac OS X using Xamarin.Mac - macos

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!!

Related

Export/Save action customization for photoeditorsdk

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!

Add a second UIViewController within a single-view application

I have a single-view application open. I need to have two storyboard views (UIViewControllers), because one is a Table View, but when one of the Table View elements is selected it brings up another screen with a normal UIViewController. Is there any way of creating a second storyboard view (UIViewController)?
Of course! Those templates Xcode provides are in no way "set-in-stone". When Xcode created your Single-View Template, it just gave you a base for creating something more. You can create additional classes, view controllers, views, and resources (other than what Xcode starts you off with in a few ways).
To add another View Controller to your Storyboard, just drag and drop one from the Object Library:
It seems like you do not have a basic understanding of using or developing with Xcode. I would recommend reading over all of Apple's documentation on Xcode before going any further. The Building A User Interface section may be of particular interest to you.

How To Create A Menu With Images and Pages, Like iPod Menu

I'm trying to find a tutorial or book, that explain who to make a menu application, like the iPod/iPad menu, with images as buttons, and pages. What i'm trying to do, is a menu, with a Popover window, when an option from the popover is selected, then the menu is filled (with code) with the buttons/images, that can be located in more then a page.
Thanks you in advance
Okay there are two things you can use here:
The Three20 library , which has several extra components you can use as well: repository here
If you want just a view similar to that and nothing else, you can go with myLauncher: repository here
I know there are probably more, but these were the main two I looked at when I went looking for a similar view.

Enable Edit Menu for NSTableView

I'm new in cocoa but with some experience with Cococa-Touch. As I am developing a OSX Lion app that uses tables (NSTableView and NSOutlineView), I am having troubles trying to add copy-paste features to tables.
I have no problems with drag-n-drop features that I have coded in table view controllers. But I cannot make edit menu options (copy and paste) enable.
I did read apple documents, but I'm missing something. I can't make it work. Can you please guide me with the first steps to enable that edit menu options and attend them from table view's controller?
I have solved it, so I answer my own question.
I have subclassed NSTableView and NSOutlineView and, in the new class, included the methods: -validateUserInterfaceItem: , copy: and so on. I was erroneously expecting to receive actions in Table Delegates.

xcode/interface builder linking to page

Hi all
I am a newby app developer infact I am still in high school, I am making a radio app and I have made the channel list using interface builder (mainwindow.xib in xcode) now I want to be able to click on a link/button in the main window and that take me too a new page in the app where I can have a play button and maybe a symbol etc. I know it is probably a trivial question but I am stumped, but how do I go about doing this if someone could place it out in step by step or even a few screenshots it really would be apreciated?
Many Thanks in advance
David
So, basically you want to be able to use a UIButton to take you to an entirely new view controller? Well, for your particular case, I'd recommend trying a Tab bar controller. When you create a new application, it gives you an option for what type of template you want, and Tab bar controller is one of them. This creates a black bar across the bottom that lets you cycle between several different independent view controllers. Just create a new tab bar application, and copy/paste your existing code into one of the views, then use the other one(s) to do whatever else you have in mind. Hope this helps!

Resources