I looked for this on the web, but I could not find any clear tutorial on how to successfully implement an NSCollectionView. How should I proceed?
In Interface Builder, I can drag an NSCollectionView to the main view, and I see that there are two other new views in the documents window: I suppose one is the actual NSView inside the collectionView, and the other one is the NSView prototype for each of the elements that will be displayed inside the collection.
But from now on I don't have any idea about what to do.
Any help would be very appreciated, but thank you anyway in advance.
—Albé
Xcode > Help > Developer Documentation...
The Collection View Programming Guide contains a step-by-step tutorial. (In fact, that's all it contains at present.). The sample app IconCollection is all set up with reasonable bindings and code to show how the collection view works.
Related
I want to make an view that looks like a wall in swift 3.
Here is an example:
Every entry should look like a square with some information.
Is there any framework which I can use or do someone know a solution for that?
I can't comment because of reputation issue. You can use UICollectionView if every entry has same width and height.Here is a tutorial https://www.raywenderlich.com/136159/uicollectionview-tutorial-getting-started.
If not, you can create subviews using UIView with your desired UI components.
I'm trying to build a UI which look like this:
I'm using a storyboard with Xcode but I don't know how to start. I think a need different view in the window to manage button, text and tree but I don't know I to do it. I have try to use a split view but it gave me only 2 views instead of 3.
Any help in Cocoa and storyboard is welcome.
Thanks
Can't see where you'd want to use an NSSplitView but the UI you're attemting to create is trivial -
A plain NSWindow with the toolbar items configured as per your screenshot.
An NSOutlineView for the tree view with the three columns,
the content border of the window sized accordingly to make room for the label you intend to put at the bottom of the window.
As mentioned in the comments one way to populate the outline view would be to use an NSTreeController and Cocoa bindings. That's probably the only slightly more complicated bit about this UI..
Ive developed for iOS in the past and recently moved over to mac development. I began a project to "get the feel" of things, and ran into an issue. Im trying to create a NSTableView to display multiple items, including a label, a 2 UIImageViews, and a UIButton. NSTableViews are way different than tables on iOS, and I cant simply create a custom TableViewCell (I think). A great example of how I would like it to look is AlienBlue for Mac: (The middle table with post information)
Can anyone shed some light on how to create this?
You have the power of being able to return whole views instead of cells in NSTableViews.
Here's Apple's documentation on View-based tables and how to populate those views in your table.
The delegate method I use most in my own view-based tables is "tableView:viewForTableColumn:row:"
Hopefully this points you in the right direction!
Please use NSCollectionView instead (set NSCollectionView.maxNumberOfColumns = 1). It's a more modern, extensible view api, that is analogous to UICollectionView.
In contrast, NSTableView was originally meant for displaying a spreadsheet table (with add-on support for custom view cells), and is less consistent with UITableView.
First off this is Xcode 4 iOS 5.0. Here is what I want to do. I have one view, we will call it view1, which has a button and when that button is pressed a different view with a table appears called tableView. I have multiple images I want to be in this table and when the image is selected, it would appear in view1. I have already researched all of this and just can not find the right material. The button and table are already working together and I can add the objects to the table, but getting those objects that I select to appear on view1 is what I am not understanding. I can not get the two nib files to work together, or Im going at it wrong.
Second question, guess this is similar, view1 displays an image that is selected from the photo library BUT is there a way to open the photo library, select the photo, and have it appear in a DIFFERENT nib view? Again this is getting the NIBs to work together. I would appreciate all the help I can get. (photo library and selection of photo already works so that code is not needed). Thank you for the help!
I have used this example to get what you have described in the above question. But with some tweak in the delegate methods and hop you will get some direction for your problems, too.
Good Luck!
Happy Codding! :)
And need any help just ask for it, don't hesitate.
It is possible from delegates in other class.
I want to know how can I create custom widgets/controls in Cocoa.
Not a full tutorial, but some guidance on what to start looking into. I'm confused by custom views, Core Animation, etc. I feel lost.
I see a lot of cool looking controls, like in Reeder App, or Sparrow etc. For example:
The left side is a collapsable menu that includes animations etc. How can I achieve something similar? I thought of using a WebView + HTML + JavaScript, but that doesn't seem like a very optimized solution.
Controls are views, so if custom views confuse you, you'll need to get that figured out before moving on to custom controls. Although you should really read the entire View Programming Guide, the section called Creating a Custom View will get you started on creating your own views. Try creating a simple view that draws a circle, for example, or the time.
When you've got views figured out, move on to custom controls. Most controls work about the same way. The user touches them, and the control responds by: a) tracking the user's input, b) changing its value, c) sending its action message to its target, and d) giving the user some feedback by redrawing itself. To get started, first make sure that you know how to use controls. Reading Control and Cell Programming Topics should help, and the section titled Subclassing NSControl covers (obviously) creating your own subclasses.
The example you provided is pretty clearly Apple's Mail.app. The view on the left side of the window might be an instance of NSOutlineView, or it might be a custom class. Either way, NSOutlineView would be a good starting point if you want to duplicate that functionality. NSOutlineView is a subclass of NSTableView, which in turn is a subclass of NSControl, which in turn is a subclass of NSView. Read Outline View Programming Topics for help getting started -- tables and outlines are extremely useful, but also more complicated to use than basic controls like buttons and text fields.
I know it's only a part of the UI, but I've recently coded something similar to the sidebar. If you look though the source-code it may give you some help on learning how to use custom controls and cells.
You can check it out on Github:
https://github.com/iluuu1994/ITSidebar