Home > iPhone SDK > Magnifying Glass in a Text View inside a Table View Cell
Magnifying Glass in a Text View inside a Table View Cell
Posted on Monday, March 23, 2009 by android apps market for tablests
Okay, I'm surprised nobody reported this one earlier, but there's a bug in the Chapter 9 application. If you tap-and-hold inside one of the text fields to bring up the magnifying glass, that works, but if you then try to move the cursor position after the magnifying glass comes up, no luck.
My guess as to what's going on is that because UITableView is a subclass of UIScrollView, it intercepts the drag event long enough to mess with UITextField's drag handling code.
After the problem was reported, I did a little research. Turns out there's a workaround for this behavior posted at Stack Overflow by Stephen Darlington .
I'm updating the project source code with the workaround, but it may take a few days to get the new version posted. I've been working through the book projects trying to get them to run under the 3.0 SDK, but need to back out any 3.0-specific changes before I can post the code so that I don't risk unintentionally violating the NDA. In the meantime, here's how you can fix the behavior in the Nav application from the book. In PresidentDetailController.m, add the following method:
Then, in viewDidLoad, add the following line of code:
That basic approach should work anywhere you have text fields or text views inside a table. This won't work if you need editing mode on the table, however, if you've got both editable fields and are using edit mode, you're probably violating the HIG anyway and should consider a redesign.
My guess as to what's going on is that because UITableView is a subclass of UIScrollView, it intercepts the drag event long enough to mess with UITextField's drag handling code.
After the problem was reported, I did a little research. Turns out there's a workaround for this behavior posted at Stack Overflow by Stephen Darlington .
I'm updating the project source code with the workaround, but it may take a few days to get the new version posted. I've been working through the book projects trying to get them to run under the 3.0 SDK, but need to back out any 3.0-specific changes before I can post the code so that I don't risk unintentionally violating the NDA. In the meantime, here's how you can fix the behavior in the Nav application from the book. In PresidentDetailController.m, add the following method:
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
{
return NO;
}Then, in viewDidLoad, add the following line of code:
self.editing = YES;That basic approach should work anywhere you have text fields or text views inside a table. This won't work if you need editing mode on the table, however, if you've got both editable fields and are using edit mode, you're probably violating the HIG anyway and should consider a redesign.
Category Article Book project, iPhone SDK
Powered by Blogger.
Blog Archive
-
▼
2009
(496)
-
▼
March
(36)
- Introducing Google Brain Search for mobile
- Speed with a Catch
- Apple Packaging
- Mobile internet usage and useful mobile ads
- WWDC First Time Guide
- WWDC Accommodations
- Wavefront OBJ Loader Open Sourced to Google Code
- Apple Store LA Book Sighting
- Differences in Delegation
- Icons for Multiple Developer Tool Installs
- NSConference
- Xcode Single Window Mode
- The Greatest Week of the Year
- WWDC Was Announced - June 8 - 12
- One Year In
- Limiting Text Field Input
- Look Ma, No Hands - Google Mobile App for Blackber...
- Updated to the Kotaku / Refund Clause Issue
- Kotaku and the Technicolor Contract Clause
- Rumor Mill
- Resuable Reusable Classes
- Guess Where These Were Taken�
- Magnifying Glass in a Text View inside a Table Vie...
- Image Processing on the iPhone
- A Freebie
- Version Control is Your Friend
- New YouTube App for Windows Mobile and Nokia S60 p...
- Something I CAN Tell You...
- Wish I Could Say More
- A Word of Caution about SDK 3.0
- On the fate of SQLitePersistentObjects�
- iPhone OS 3.0
- Particle Generator Bugfixes
- Here comes Google Voice
- New Image Search Results for Android and iPhone
- Finance for Android App
-
▼
March
(36)