Xcode UI Element -> View that points to another view - xcode

Is there a way I can make this view using Cocoa.
Also it needs to be resizable meaning the width should be depending on the text length? Thank you in advance

Yes, you can. Look at the NSPopover Class Reference.

Related

Custom view for swift

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.

Build a Cocoa UI for OSX

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

Static UITableView not showing cells with subviews (UIButton, UISlider etc.) in Content View

I've run into a peculiar problem with Xcode. I have a custom UITableViewController that appears as a popover for a few settings in an iPad app. It's a static table view with just 3 cells in 2 sections. It looks fine in the Storyboard editor, but at runtime the cells with custom views (UILabels, UISlider, UIButton) do not show up at all, but those custom views do (in random places).
When I delete the custom elements from the cell or change the cell to anything but custom then they show up fine, even if the view (like basic for example) contains a label in its Content View. It's a lot clearer to see with the attached picture.
To solve this, I've created a completely empty cell below those with custom elements. It looks fine, but I can't interact with any elements. User Interaction is enabled for all elements, cells, and the entire table view. If you have any ideas how to solve that or how to get the cells working properly so I don't need the blank cell hack that'd be much appreciated!
I'm using Xcode 6 beta 7 on OS X Yosemite, programming in Swift.
Thanks in advance!
The question has been answered here Stack Overflow Setting up Auto Layout connections from the label to the Content View solves this issue.
It was a combination of the above link as well as this one that finally solved it.
I added the 4 constraints from each object (UIButton and UISlider) to all four sides of its cell's Content View (top, bottom, leading, trailing). Then, I had to check the "installed" checkbox for each constraint, which was not checked.
Thank you so much for your help, it's working great now!

NSOutlineView for 10.6

I am new to cocoa. I will need to implement an NSoutlineview for 10.6 OS X and above. I have hierarchy of data which must be shown in the form of outlineview. The cell for outline view must contain an image and text. Could some body please suggest on how to go a head with this?
thanks
an outlineview is basically just a tableview so all tutorials for NSTableView apply to it
only the dataSource methods differ
so: http://www.martinkahr.com/2007/05/04/nscell-image-and-text-sample/
and combine it will a tutorial of a cell based outline. e.g. http://devcry.heiho.net/2012/02/treeview-in-cocoa-nsoutlineview.html
For your best practice you can refer this sample code Sourceview
To customize your text you need to set your cell as ImageAndText cell as shown in that samplecode

IB builder or programmatically draw?

What do you advise? should I programmatically draw my textfields, labels, images or should I use IB?
Would it make any difference? I have scrolling issues (bit jerky) but not something I cannot live without!
I would use IB to help maintain the app. Jerky performance is usually a result to memory management issues and not specific to IB. IB just does the object creation and sets common properties, so do it in code, or in IB the end result is the creation of objects and setting of properties.
ok. problem solved. you were right and wrong regarding the IB...
to explain myself:
I was loading my cell from a nib file.
The trick and thanks goes to this site: http://iphoneincubator.com/blog/tag/dequeuereusablecellwithidentifier
i forgot to set my cell identifier to the nib file so i was creating the cells every time they were scrolled off the screen!
so tip!
When you load from nib ALWAYS put the right identifier in the "identifier" place!!!
thanks to nolimitsdude who actually pointed to the right way!!

Resources