PDA

View Full Version : UITableView - Extremely wierd behavior




Sbrocket
Apr 13, 2008, 08:29 PM
Ok, so I've been working on this UI for a while and its gotten to the point where I can't hope this bug will just resolve itself any longer.

UI Pic, to give you an idea: http://dl.getdropbox.com/u/417/Picture%201.png
This is what's happening:

On the first click of a certain row, the row will highlight and the tableView:willSelectRowAtIndexPath: delegate method is called. However, nothing else is...no setSelected:animated: in the UITableViewCell itself nor the tableView:selectionDidChangeToIndexPath:fromIndexPath: delegate method. The row stays highlighted, and if I clicked a different row at this point the second row would also be highlighted.
On the second click of the same row, tableView:willSelectRowAtIndexPath: is called again as well as setSelected:animated: for the UITableViewCell. However, tableView:selectionDidChangeToIndexPath:fromIndexPath: STILL is not called.
On the THIRD click of the same row, all three methods are now called. However the "fromIndexPath" in the last delegate method indicates that the selection's row changed from 0 to whatever row was clicked.


What the flying *******?

All of the same behavior minus my ways to check for it occurs whether or not I override each of those three methods.

I am completely stumped. Any ideas? :mad: :(



RossOliver
Apr 13, 2008, 11:05 PM
I've been getting very temperamental event behavior from my views too. It seems to get worse as I layer more views on top of one another, so a UITableViewCell may highlight on the first click, appear to do nothing on the second and trigger the event on the third...

It's driving me mad and I'm putting it down to a bug in the simulator :rolleyes:

-Ross

drivefast
Apr 14, 2008, 01:15 AM
i know what you guys are talking about. i found the behaviour of the simulator getting close to what's expected when launching the app from the springboard instead of xcode. that is: launch with "build and go" to get the simulator running, then quit by pressing the home button, and finally restart the app from the simulator's springboard. kiss your debugger goodbye (in the beta3 my NSLog's wont work anymore anyway) but at least... get it *** running. oh, and fwiw my routine includes quitting the simulator between the builds, as well as periodic content resets. good luck.

Sbrocket
Apr 14, 2008, 06:39 AM
Well its not just the simulator since I've tested it on both that and on the device itself with the same behavior occurring on each, so if its really a bug its a bug with the SDK. I don't think it is a bug, though, since Apple's sample apps perform selection from a UITableView just fine.

The problem is...I don't see how their implementation differs from mine. I do have more UIView layers than a few of their apps, so I suppose it could be something with events getting passed to the right UIView, but it doesn't make sense that some of the methods that sounds happen on an event get called but others don't.

Sbrocket
Apr 14, 2008, 12:07 PM
So I figured out what it is. Apparently, UITableView doesn't like you setting scrollEnabled = NO. That sounds like a bug to me, but at least I've got a workaround now.

So, anyone that's reading this...do NOT set scrollEnabled = NO.

RossOliver
Apr 14, 2008, 02:49 PM
So I figured out what it is. Apparently, UITableView doesn't like you setting scrollEnabled = NO. That sounds like a bug to me, but at least I've got a workaround now.

So, anyone that's reading this...do NOT set scrollEnabled = NO.


Nice find - that sorted it on mine to...

Do you get little event anomalies such as when a modal view pops up the first click on a cancel button (or any button) doesn't register? I seem to get this on all my modal views and I have an issue with my navigation button that presents a modal view working once, then it stops animating the button when you tap it but the events are still triggered...

-Ross

Sbrocket
Apr 14, 2008, 04:29 PM
Nice find - that sorted it on mine to...

Do you get little event anomalies such as when a modal view pops up the first click on a cancel button (or any button) doesn't register? I seem to get this on all my modal views and I have an issue with my navigation button that presents a modal view working once, then it stops animating the button when you tap it but the events are still triggered...

-Ross

Yeah, I've got weird anomalies like that too. There's a bug where using -[UITableView selectRowAtIndexPath:] doesn't call the tableView:selectionDidChangeToIndexPath:fromIndexPath: delegate method too, even if the selection did change (filed a bug on this one). Oh, and if anyone knows a workaround for that I'd be really grateful.

Best thing to do when you find a problem - file a bug with http://bugreporter.apple.com. They're kinda getting overloaded with bugs right now so response time is slower than usual, but it'll get them aware of it eventually.

Now I've gotta figure out how to implement Safari's pop-down menu UIPickerView...but that's a subject for another thread.