Text magnifying glass hangs with UIKeyboardTypeEmailAddress? - iphone

I have a UITextField that I put into a UITableViewCell that I put into a grouped UITableView. I noticed today that if I hold my finger down to bring up the iPhone magnifying glass, if my UITextField's keyboard type is UIKeyboardTypeEmailAddress, the magnifying glass is displayed, but it just hangs - I can't move it left or right, I can't make it disappear, it just hangs.
I thought to myself, hmm, odd, maybe it's something to do with UITextFields in cells in a grouped UITableView? So I tried on some other UITextFields, and this does not happen for ones that do not use UIKeyboardTypeEmailAddress.
Has anyone seen anything like this? Is this just a bug in Cocoa Touch? Or is there something I could possibly be doing wrong?

I am getting the same behaviour although my UIKeyboardType is just normal text - so its not the type of keyboard.
I too have a grouped table - and my text field is on the first row (not sure if this is relevant but thought it might help spot similarities).
Update - I noticed that when testing with the 3.0 sdk - I don't get this error (so it seems like something apple has fixed?). I have gone back and tried compiling with 2.2.1 and 2.2 and I still get the error on both of these versions.
I have discovered a fix described here: Editing a UITextField inside a UITableViewCell fails

Related

iPhone keyboard with weird dot

Where is this dot coming from?:
There is a dot hidden behind keyboard and highlights to blue when pressed (trying to press ?123) to change keyboard mode.
I have noticed it in few placed in my app and in iOS 6 (also with decimal keyboard, one can still see this dot which interferes with comma character).
There is nothing special I am doing with responders (normal UITextView of UITextField fields).
Anyone has idea what could be the cause of it?
Just to exclude popular cause:
I have rootViewController of my key application UIWindow set to my root navigation controller.
It looks like the "old"(before iOS6) way to add a dot or return-key to UIKeyboardTypeNumberPad but with a wrong keyboardType.
Something like in this tutorial: http://www.neoos.ch/blog/37-uikeyboardtypenumberpad-and-the-missing-return-key
Have you ever used this kind of custom keyboard in the past? Or maybe you don't know that you use it. Is there a category of UITextView you have overlooked?
Search through your project for e.g. "#interface UITextField (" to find the category.

iPhone: varying transparency of previous/next button on inputAccessoryView

Short version: I have a working solution using a UISegmentedControl but I don't like how it looks. When I use Safari, it "dims" either previous or next when it's at the beginning or end of the list of input fields. I can't convince a UISegmentedControl to do that, so how did they do it?
Long version:
I have a UITableView with cells that have text fields. The text fields take numeric inputs (floating point numbers, generally). That means I present the keyboard with keyboardType = UIKeyboardTypeDecimalPad. That also means no return button, so I need a good method to move between cells OTHER THAN touching the cells. I'd like to do it the same way as, say, iOS Safari does it - with a little toolbar that says "previous | next ... done."
I have code that does all of that (sets the textField.inputAccessoryView to be an instance of a UIToolbar with the appropriate buttons), using a UISegmentedControl for the previous and next button. I have that working so that next moves to the next cell and previous moves to the previous cell.
So why am I here? I can't get the dimmed previous/next behavior seen in iOS Safari to work with a UISegmentedController and I don't really want to implement all of that myself if I don't have to (at that point, my CCB will invoke one of the two rules it uses to reject changes: Rule 1) If I don't think it's a good idea, then I won't implement it; Rule 2) If it's easy, I'll probably do it).
(I would have posted pictures, but I'm too new to SO - sorry)
When I try to do the same thing it looks and acts like a Safari middle text field, but I can't seem to get it to look like the Safari version of first or last text field.
I've tried enabling, selecting, even changing the bar background color, but none of them seemed to work. The background color seemed to get closest, but I had to have 3 different toolbars based on when it was first, last, or middle, and even then it wasn't great.
Solved. The issue was that the "enabled" setting of the various segments as set in IB does not make it to the executable. I have to programmatically disable the previous or next segment in the view controller. Once I did this, it now appears as I want it.
When I set up the UISegmentedControl in IB, I set one segment to enabled and the other to disabled (== not enabled). In the debugger I started trolling through the settings of the various segments and found that actually setting the segment to disabled makes it work in the way I wanted.
For example, in the "nextToolbar" that contains a UISegmentedControl that is attached to "nextControl," only the Next button should be shown as active. That means I have to set the Previous button to disabled. The Previous button is at index 0, so disabling it means to do this somewhere before it's used (I put this in viewDidLoad:):
[self.nextControl setEnabled:NO forSegmentAtIndex:0]
Similarly, for the prevControl, where only the Previous button should be active, I use:
[self.previousControl setEnabled:NO forSegmentAtIndex:1]

iPhone: Having trouble figuring out how to scroll a UITableView with custom UITextField cells automatically when entering text

Ok, I know this seems like a duplicate question, but don't think it is. I actually have this implemented already (thanks to this SO question), but it seems sluggish. I am willing to tweak it a bit, but I ran across a demo app by AboutObjects that seems to have exactly the right functionality with absolutely no code doing it. I have looked through their demo code dozens of times, and I can't figure out what they are doing that I am not. The code to look at is in their iPhone Development Tutorials section, and is called "Editable TableView" (2nd from the bottom). There are a couple of questions on the forums on that site asking how they got the functionality, but there is no answer (other than "It's a built in function"). Does anyone have any clue as to why their UITableView would implement the input scrolling by default (including being able to scroll the view manually when the keyboard pops up, which I cannot get to work).
Not sure what I was doing wrong, or what I changed, but it "just works" now. No code necessary. Weird.
I believe the UITableViewController handles the automatic scrolling including scrolling up making rows visible when the keyboard pops up.

Upon exiting UISearchDisplayController's search table view, the screen flashes

I am using UISearchDisplayController to implement the search feature on a table view. My table view cell uses custom background image.
When you first type a letter into the search textfield, the search results start appearing. However, when I click cancel at this point, the screen flashes white. This is not as noticeable if everything uses the standard white, but since my table view cell uses custom background, the white flashing is quite noticeable.
Where is this flashing coming from? Is there anything I can do to remove this flashing? (You can see this flashing on standard Apple apps too but it may not be very obvious if the table view uses white background)
Another SO post mentioned this very problem too - Customize UISearchDisplayController (search for the word "Flash")
Found a good work around for this here at Apple's Dev Forums.
Basically, the flash is by design and there isn't any way to customize/disable it. However, the poster in the link came up with a simple work around -- remove the search display table view all together (removeFromSuperView). Works absolutely fine for me.

Custom UITextField/UIButton

What I'm trying to do is replicate the NSTokenField like UITextField seen in the Mail app and Messages app (type a contact and it comes up with suggestions).
I've got the autocompleting working perfectly, when you type in a UITextField, a UITableView pops up showing any matches that it can find in an array, when you click one it adds it to the UITextField. I'm really happy with this so far.
The problem I've run into now is making the controls look like those in the native apps. Afterall, design is everything!
My first question is how can I add that shadow look to the UITableView? Looks like it's sunk down behind the UITextField.
Secondly, I know I'm going to have to subclass the UITextField to make it look the way I'd like it to, but I've got no idea where to start with that. Some pointers or a sample would be great!
Lastly, I think I need to create a custom UIButton with space for text and the blue gradient then add it to the UITextField. Same problem as with the UITextField, not really sure how to subclass the UIButton (what methods it needs to draw and stuff) or how to add it to the UITextField in such a way that when you click backspace on in the UITextField, the button will be highlighted, then deleted if backspace is clicked again (exactly how the NSTokenField works).
I've included an image just so you can see what I'm talking about:
http://www.thermoglobalnuclearwar.com/stuff/mail.jpg
I have taken a look at Joe Hewitts Three20 project but I couldn't make heads or tails of it.
I'd like to start very simply and understand everything that's going on rather than just dragging his code into mine and not having any idea what's going on!
Any help is greatly appreciated!
Thanks,
Tom.
Have you considered using the Three20 library? It contains a control which I think does what you want (TTPickerTextView).
As the website description states
TTPickerTextField is a type-ahead UITextField. As you type it searches a data source, and it
adds bubbles into the flow of text when you choose a type-ahead option. I use this in
TTMessageController for selecting the names of message recipients.
At a minimum the source code might give you some pointers on how to achieve the various visual effects.
Okay, I've got the shadow working underneath the UITextField, and I've added the "To:" label to it. It looks great!
So the final thing is the blue NSToken like control. I've started to think the easiest thing is just to subclass a UIView and draw the blue gradient and label inside it. Which brings me to some more questions:
I found this: http://github.com/leonho/iphone-libs/tree/master which draws a nice rounded view and I've adapted it to add some text to it rather than a number, what I don't know how to do is draw a gradient instead of a solid block of colour.
After that there's just the matter of adding the rounded views to the UITextField, moving the cursor and working out how to delete the views when the cursor reaches them, but I'll tackle that when I need to.