How to create events for custom control?

Appcelerator Titanium: How can I create a custom picker control?

  • See screenshot of custom picker here: I know there isn't a way to style the picker control in Titanium. This picker only needs to work on iOS (iPad only). I was thinking I could hack the TableView control to use instead of the picker to achieve the style desired. Is that reasonable? How would I snap the TableViewRows so one is always in the center like seen in typical picker controls?

  • Answer:

    I would approach this by using:- a scrollableview to allow the scrolling up and down (or a tableview but scrollableview would be more lightweight) an overlay view that fixes position above the view that handles the selection lins in the middle in the same overlay as above OR a new one, have a gradient that goes from white in the middle to black/grey top and bottom - set opacity to light e.g. 0.3 or something and have this sitting on top add a snap to the scroll so when the row falls between the selector lines you snap the row to the lines. This could be done on the scroll event of the scrollable view. This *should* allow you tot scroll up and down, let go and have it snap to the selector, and the gradient should give the impression that the items are fading away. Wrap all this in a common JS module and it's nicely reusable. Hopefully that makes sense.

Jason Kneen at Quora Visit the source

Was this solution helpful to you?

Other answers

The requirement to snap to the closest value made me think of http://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.ScrollableView. You could try to achieve this with 4 ScrollableViews that you rotate 90 degrees while rotating the views in it -90 degrees. No idea how performant that would be.Another option would be to wrap a module like https://github.com/filipealva/PickerView that exposes a customisable UIPickerView.

Fokke Zandbergen

The  iOS image picker is a controller. It allows you to select an image from  device gallery or capture it from the Page on Camera. The  iOS library contains a very useful class known as  UIImagePickerController. It is a user interface that provides the  functionality to interact with the camera or the photo library. It  requires the use of its delegate to respond to the user  interactions. You have to set sourceType property to define role and  appearance of ImagePickerController. http://www.theappguruz.com/blog/ios-image-picker-controller As a reference i will suggest you the above link.

Vivek Tank

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.