Using NSWindow or NSPanel as "CardLayout" - cocoa

How guys.
I'm not top dev in java, but what I`m really not is cocoa top dev :P
I would like to have your assistance to produce a layout with cocoa and IB to work just like the CardLayout in Java.
Do you have some idea of how to do it?
Thanks for the attention!
EDIT:
CardLayout: A set of panels ("cards") are designed to compose a "deck of cards".It works like a queue of panels, in which only the first "card" is shown on the interface.I can easily interchange between cards if I want so to modify the interface to the user.
I hope I could help you to help me. =)

A tabless NSTabView can be used for something like this.

Related

GridBagLayout in cocoa

Is there any feature equivalent to "GridBagLayout as in swing" in cocoa?
Spent some time in searching with no luck.
Any help or suggestions to create something like GridBagLayout in cocoa is appreciated:)
Thanks:)
There isn't. Closest thing to GridBagLayout in Java is probably the NSCollectionView displaying an array of content as a grid of views:
https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/NSCollectionView_Class/Introduction/Introduction.html
https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/NSCollectionView_Class/Introduction/Introduction.html#//apple_ref/occ/cl/NSCollectionView

Animating toolbar with textfield up above the keyboard when the the textfield is edited

Okay I'm looking for some assistance I have researched and read posts that pertain to what I am trying to do, but none of the examples include a toolbar with a URL textfield. I am not looking to make any money off of this browser. I want it for personal use, furthermore I am not trying to insult nor take what you guys do as a profession as a joke. So if I come across that way I sincerely apologize. My toolbar is located at the bottom of the screen and I have a URL textfield. When I use the textfield to enter a website address the keyboard covers the toolbar and I cannot see what I am typing. So if you can offer some assistance that would be greatly appreciated.
I'm getting an error on the CGRect frame =self.scrollView can someone please assist me? Thanks!
I hope my code is not far off the websites load perfectly fine. I just want to move the toolbar up when the textfield is edited and drop back down after go is press....I have tried to include the toolbar inside the scrollview but I do not know what to do after.
Best regards! :)
CGRect frame = self.scrollView;
this line must be:
CGRect frame = self.scrollView.frame;

HTML-like view in Cocoa?

learning Cocoa can be pretty tough for web developers. Some things are so simple in HTML, and I have no idea, how to do this in Cocoa.
Let me just show you an image here, to show you what I have on my mind.
So it's kinda like a blog. Each post has variable length, so it can take up some space. Also, you're able to scroll through posts.
I was thinking about using NSTableView or NSCollectionView, but since I don't know much about Cocoa, I'm asking you for advice.
Also please do link any related articles.
Updates
So here are some things that I discovered.
I could make a subclass of NSCell and use it in Table View. I can use it, I can put there a string, something like this:
http://pastie.org/1140412
(please take a look at this code, I'm wondering if I should use awakeFromNib/setDataCell combination)
But string is not enough. I need a NSTextView. The problem is, it doesn't have method like drawInRect: withAttributes:. So I don't know how to draw it into that cell. I guess I'm missing some basics here, so I'm just gonna study some Cocoa views now.
Any ideas are welcome.
You want to use a NSTableView. And I will recommend to take a look/glance at NSTableView, NSTableViewDelegate and NSTableViewDataSource docs:
http://developer.apple.com/mac/library/documentation/cocoa/reference/ApplicationKit/Classes/NSTableView_Class/Reference/Reference.html
http://developer.apple.com/mac/library/documentation/cocoa/reference/NSTableViewDelegate_Protocol/Reference/Reference.html#//apple_ref/doc/uid/TP40008622
http://developer.apple.com/mac/library/documentation/cocoa/reference/ApplicationKit/Protocols/NSTableDataSource_Protocol/Reference/Reference.html#//apple_ref/doc/uid/TP40004178
You choose the object you want to be your datasource depending on the data you have.
The delegate is the object that helps you to so some settings, like rows, groups, cells, etc.
There are useful methods of NSTableViewDelegate you want to implement like – tableView:heightOfRow:
and just google NSTableView tutorial or something, there are many good examples ;)
You could just use a WebView and write it in HTML.
Look at http://mattgemmell.com/source for an example: the Skinnable App one.

Clear example and best approach to NSCollectionView

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.

Autosizing boxes and positioning in Cocoa

I'm creating an application, from which a part looks like this:
boo http://img188.imageshack.us/img188/7808/schermafbeelding2010021y.png
I all dragged them to a window in IB, but the problem is that the NSImageView, Action Buttons (Suggest, Send, Poke etc...), Information NSBox, and Friends NSTabView can all vary in height. They should always be placed below each other, with a margin of 8px. Just like on Facebook. I thought of a very modified NSSplitView, but maybe there are easier ways. Can anyone help me out?
Edit: I have placed the action buttons in a Custom View with class NSView.
Thanks
You'll have to manually resize the views yourself. Cocoa does not provide Java-style LayoutManagers. However, I don't think it would be too hard to recreate one...

Resources