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
Related
I would like complex button, which has several text elements and which should change their state and color depending on button state.
Unfortunately, I see that Xamarin button has only predefined image and text parameters.
How to have multiple controls inside a button in Xamarin?
Visual state manager(Only XF 3.0+) have three states: normal, disabled, focused which is named "CommonStates", or you can create custom states.Maybe it could help:
https://learn.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/visual-state-manager
I think you must read more in content view, where you can add labels into stacklayout or grid with your own api bindable property, then use it wherever you want in your code:
https://learn.microsoft.com/en-us/dotnet/api/xamarin.forms.contentview
In the current project,I am using an UIViewController with 2 text Fields and a text area.
Text fields are used as drop-down (custom logic) and based on drop-down selection information is displayed in text area for e.g. State and city are two drop down. On click of State drop down city data is populated in second drop down and on selection of city corresponding info is fetch and displayed in Text-area.
I have a requirement to move this logic to custom popup. Can anyone guide me how to achieve this with minimal changes in Xamarin iOS.
It would use UIPopoverController in this care. You already have a view controller with all the UI elements. You can use it as the DetailViewController so you don't have to change that much. Only it's size and the background. You can use it for both iPhones and iPads.
Here you have a sample project with source code:
https://developer.xamarin.com/samples/monotouch/Popovers/
Create a new UIViewcontroller in the storyboard, set the background colour of the main view to transparent, then create another view on top of that and put in any controls you want to display etc. then in the UIViewcontrollers init method add in the following:
public OverlayView(IntPtr handle) : base (handle)
{
ModalPresentationStyle = UIModalPresentationStyle.OverCurrentContext;
}
That way the background view that you've set as transparent won't just show black, it'll show in the context of the screen that called it, then you just present it as you would any other view, and add in some dismiss action events if you want it to pass data back etc. Hope this helps.
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.
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.
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