Category Archives: iOS4

Undocumented Annoyances when moving code to iOS 4

Maybe it was the fact that AT&T messed up my upgrade date, so I don’t still have my iPhone4. But I think it’s the fact that I lost valuable time tracking down these issues when I moved my projects to the iOS 4.0 SDK. These 4 issues are undocumented changes that came up by simply moving a project running under 3.1.3 to be built under the 4.0 SDK.

1. The definition of shadows in Quartz has changed. They used to be drawn based on the direction of the light casting the shadow. Now, they are based on the direction of the shadow itself. There’s a post on the Apple forums claiming it is by design, and actually changed in version 3.2. So my nice custom drawn buttons all look wrong. And worst of all, the only way to support 3.1 is to detect the version number and change the sign of the y parameter. After all the forum posts where we were told to detect features, and not the version numbers. Grumble, grumble.

2. Using a custom UIButton in tableFooterView is displaying too large. I have an image that is 297 pixels wide, and I use it to make a custom button 297 points wide. And 4.0 on both the 320×480 simulator and the 3GS draw it much larger, so it can’t be a scale issue. I can’t tell how big, because it just goes off the screen. This is the most aggravating personally, because I still have no reason why this happened, and no one answered about it on the forums. After wasting time trying to fix it, I moved the button to the sectionFooterView, where it renders perfectly. It’s a good thing I don’t know any Apple engineers, I would have yelled at them about how much time this wasted.

3. Calling dismissModalViewControllerAnimated when there are multiple view controllers to be dismissed is suddenly calling “viewDidAppear” on all the controllers being dismissed. This would probably not be apparent, except that one of my view controller plays a sound everytime it appears. Now the sound is being played when it is being dismissed. This behavior is bizarre, and disconcerting because there does not seem to be another way to detect when a view controllers view is displayed. And, again, no answer on the official forums. I’m having to add a goofy BOOL property to the view controller that is only set when the controller is created.

4. touchEnded is being called differently. This one is actually working out to be a feature, but I can’t find it documented. Basically, under 3.x, if you press inside a view, and release your finger outside of that view, touchesEnded is never called. Under 4.0 it is. The reason this is a feature is that one of my apps is designed to be used by children who might not have the motor control to press and release inside the same view.  So under 4.0 they can use my control, whereas the 3.x version needed to be fixed. By duplicating the same code in touchesEnded and touchesCancelled, it looks like things are working correctly.

I know this is not an exhaustive list, and other people are having worse issues, like crashes and major visual issues, moving to 4.0. But even these 4 were enough for me to curse the new SDK. Of course, when my iPhone4 gets here, I’m sure I’ll get over it.


1 Comment

Filed under iOS4