How to Create Search TextField like Nokia? - textfield

In Nokia S40 the search field for the contacts is looked like this
This TextField is really interactive, if I put some text the magnifier will change into x Button. I've tried to create the TextField in LWUIT and override the paint methods to put the magnifier image but it can't use as a button.
Are there any component I can use to recreate something like this (Especially with LWUIT)? Or maybe are there any ready-to-be-used component from Nokia to create something like this?
Best Regards

You can do something similar to that, but it won't look like the native SearchField, but it will work fine.
What you can do is this.
Create a container with a boxLayoutX and put inside it a TextField and a Button. When you capture that the TextField has text inside, change the Image attached to the Button to a X and here it is. You only need to implement the functionallity of the Button.

TextField has a setHintIcon method allowing you to do just that.

Related

Xcode IB: Replace button with another type?

In my Xcode project, I have a few buttons in the main window that I would like to replace with another type of button. In this case, there are a few rectangles and a rounded rectangle button. Is there an easy way to replace the buttons with another style, or am I stuck with deleting them and settings them all up again? Thanks in advance!
You can select button type custom and use your own special background as the button in Interface Builder.
If you want to further customize your button, I suggest making an outlet of it and customize it programmatically.
Good Luck!

iOS: People picker inside UIPopoverController, search keyboard distorts popover

I have a people picker inside a UIPopoverController, since it has a search field, which will trigger the keyboard when tapped, then I got this ugly result:
the arrow of the popover is UP which is best look in my app, I also tried to use UP | DOWN but it does not work(still always UP), I know I can use only DOWN arrow instead, but that should be the last solution, I wonder is there any method to deal with this?
Thanks!
update:
I was thinking that can I use UP arrow first, then when the search field becomes first responds(not sure how to detect this), I change it to DOWN arrow(also not sure how to do this)?
update 2:
also the view is not a table or something that can be scrolled, so I cannot scroll the view to make the popover look fine.
You are right, that is quite an ugly resolution.
The problem is that the UIPopoverController is coded to avoid colling with the keyboard view.
I think the only way you can work around this is to either create a custom UIPopoverController that ignores the keyboard appearing (i believe some listeners needs to be disabled on either the SharedApplication or mainscreen) or make a custom UIView that holds this.

NSTextView and highlighting links

I'm using a NSTextView with an NSAttributedString to display some links using the NSLinkAttributeName. I'm styling those links using the setLinkTextAttributes: method of NSTextView. However, I would like to give the user a visual feedback when he clicks the link, for example by changing the color of the link while the user pressed down the left mouse button. Is there an easy way to do that or do I have to use NSTextAttachment?
I don't think there is an easy way to do this if you want it to happen on the mouseDown event. If you can wait until the click is completed, then you can do it using the text view delegate method, textView:clickedOnLink:atIndex: to get the index of the clicked on link. You could then use that index to pass to the text storage method, attributesAtIndex:effectiveRange: to get the range of the link and finally, use setAttributes:range: to make whatever changes you want to the attributes of the link.
If you really need to do it on the mouseDown, then you'll have to subclass the text view and override mouseDown and maybe use something like characterIndexForPoint: to find out whether you've clicked on a link and respond as above.

adding an invisible button to the background in IB

I'm working with Xcode doing a Ipad app.
i simply want user to click anywhere on screen (not counting text fields) to perform some IBAction.I'm using an invisible button that covers my whole view.
Since I have some text fields in my view,i need to add this invisible button to the background of my user interface. I cant seem to find this option in the button attributes? any help?
Just set the button's type to custom.
Did you try setting the opacity of the button to zero?
I guess i got your point. You just want to put the UIButton(invisible) on the back of all the UITextField. The simple solution to this is open the Document Window in the IB. Now expand the view tree in the list view. Just drag your UIButton above the UITextFields and set the alpha value for the button in the property to be zero.
Hope this helps!!
iPad users don't "click". They "tap" or "touch".
In Interface Builder, I believe views are constructed with a z-index from top to bottom as they appear in the document window, so dragging your button so that it appears as the first subview of your main view should be a quick fix for this.
Have you considered other approaches? This doesn't sound like standard behaviour for an app and will probably cause havoc with anybody using Voice Over. What are you trying to accomplish?

how to make dropdown box for iphone app

how can i add a dropdown box (html select tag) in my iPhone application?
I think you cannot have a drop down list in the iphone.Instead of that it has the UIActionSheet.If you have more options like greater than 8 the UIActionSheet will have its own scroll and alert looks like table and the view will get an awesome look.Thats the only option we have.If you anything or if i am wrong just let me know
Thanks
You can create a custom combo box control. I have done this in one of my projects. You can do something like this. Create a ViewControlle with tableView in it. Make it's frame smaller. Add it's view on the view where you want to display combo. On tap of a button that looks like down arrow display tableView with some animation starting frame should just below the combo button.Hope it helps. First try this then if still you are unable to do let me know.