Can I put a NSDatePicker object in a cell of NSTableView? - custom-cell

Right now I am just using a NSTextCell with a NSDateFormatter, I just wanted to know if this was possible, perhaps by using the .
Thanks in advance!

not without making a bunch of hacking... Apple doesn't provide the date picker cell for the table for some reason. I would keep the date formatter or make it so when the cell is clicked, it pops open the graphical date picker.
I created a menu in the xib file, set the outlet for the cell's menu property to the menu, created a subclass of nsdatepicker, overrode the mouseDown:, and made it display the menu when clicked.

Related

NSPopupButton hierarchical binding

I am learning about Cocoa binding and as part of that working on a simple testbed where I populate a NSPopUpButton with some options via a NSArrayController. It all shows up fine and I can change the button selection. I then tried to bind the title of NSWindow to display the string of the data the NSPopUpButton is bound to. It works as far as startup goes..showing the first item in the popup... but no matter the change in the popup selection the title doesn't change. This all works fine if I swap NSPopUpButton with NSTableView. Am I right in thinking that NSPopUpButton does not track user selection, and that if I want to track that I need to set a property in my model to track that?
Thanks!

Where is the Monotouch Dialog UI Picker Element?

Wheres the custom picker element for monotouch dialog (Xamarin.IOS)?
// update
UIPickerView would be a wonderful element to have as a monotouch dialog element along with UIActionSheet.
Instead I journeyed into building one by hand and then attempted to fit it into an UIActionSheet. Was couple of days work (I'm a noob) but got stuck trying to clean up the aesthetics of it (think I'll just stick with a 'ok' solution of embedding the picker inside a table for now).
Just in case anyone else embarks on this adventure here's a link to make your picker:
https://www.youtube.com/watch?v=lXa9WZMcmoE
Here's a link to how to setup a UIActionSheet:
http://monotouch.2284126.n4.nabble.com/UIActionSheet-Presenting-action-sheet-clipped-by-its-superview-warning-td3897607.html
// another update
Although not a custom picker element using MT.D, you can sort of have a popup picker by linking the input view of a control (view object i.e. text field) and set it's input view property to the picker. The picker slides in from bottom whenever you click this control. Think I just have to implement a custom view with my own picker and a cancel button somewhere...hmmmm:
http://nomtek.com/tips-for-developers/working-with-pickers/
Your update is correct - you'll want to create a custom MT.D element that inherits from EntryElement, override the method that creates the UITextField and set the field's InputView to an input view of your choice. I actually just wrote a tutorial on this: Custom MT.D Input View & Element

How to make UIPickerView that appears if i click on the UITextField?

How can i make a UIPickerView that appears when i select a TextField, and the input of this comes into TextField if i select a value of UIPickerView?
How to do this? Have you an example of this?
Create the UIPickerView and set it as the inputView of your text field. It will then be animated on screen for you when you start editing the text field. The picker view delegate methods can be used to update the text field's value.
You will also want to create a toolbar with a done button and set this as the inputAccessoryView - this will allow you to dismiss the picker when you have selected your value. Again, this will appear automatically above the picker view when the text field begins editing.
Please take a look at this example http://www.techotopia.com/index.php/An_iOS_4_iPhone_UIPickerView_Example
You can initially hide the picker by
picker.hidden=YES; in your viewdidload method and for showing it when touch on the textfield you can write picker.hidden=NO; inside uitextfielddidstartediting method. Thanks.

Autosave of programmatically created NSTableColumn in NSTableView?

I have an NSTableView created in Interface Builder with some columns. I've set the tableview to autosave its settings (I set the autosave name in the Attributes Inspector and checked Column information). Now I want to add some other columns programmatically, but when I quit the app and relaunch it, these newly added columns disappear and the ones created in Interface Builder reappear.
Googling I found a work-around: changing the width of the added column gets the job done, but there must be a better solution!
EDIT: changing the column width only works sometimes.
Maybe you need to load the autosave data at the applications/NSTableView load?
the position, size and ishidden of a NSTableColumn is autosaved -- using the InterfaceBuilder autosave method. make sure to hit the 'Column Information' checkbox...

How to access an NSNumberFormatter in a text field cell?

In XCode 3.2.x's Interface Builder this was simple enough, selecting the text cell displayed a small icon for the formatter that could be selected to configure the formatter in the attributes pane.
Now in XCode 4, the formatter icon is gone! If I drag an instance of NSTextField with an NSTextFormatter from the library OR drop and NSTextFormatter into an existing cell there is no way I can figure out to select the formatter to configure it!
Add to this the fact that Core Data entities UI prototype assistant was removed and I would say IB integration into XC4 is half baked at best!
Any luck with this anyone?
you can access the formatter from the jump bar at the top of the window. if you select the component you added the formatter to, click and hold and it will turn into a drop down menu. move to the sub menu and the formatter should show up where you can select it.
it seems that you can treat the whole ui like a cascading set of menus that way.
now removing the formatter, that's a different question...
... which after further looking revealed:
over on the left side of the IB window in xcode4 is a 'dock' containing the icons for file owner, first responder etc. this column is expandable, and when you do so will show a hierarchical view of the nib file. through which you can navigate like the finder.
also, see this article:
http://developer.apple.com/library/mac/#documentation/ToolsLanguages/Conceptual/Xcode4UserGuide/InterfaceBuilder/InterfaceBuilder.html%23//apple_ref/doc/uid/TP40010215-CH6-SW3

Resources