Posts tagged ‘iphoneOS’

Astuce iphone : nombre de chiffres significatifs avec NSLog()

Si vous voulez spécifier le nombre de chiffres après la virgule lors de la création d’un NSString, la syntaxe est : ou n représente le nombre de chiffres après la virgule.

Cela marche aussi avec le C pur et la comande printf.

23 septembre 2009 at 9 h 17 min Laisser un commentaire

Mieux que le « spotlight » : les outils de bases d’ UNIX

Pour ceux qui l’ignorent encore, Snow Leopard et plus généralement la famille MacOS x, est basé sur le systeme d’exploitation BSD.

SI vous êtes un jour confrontés à la problématique de retrouver le nom d’un fichier contenant une certaine chaîne de caractère (dont vous avez oublié le nom), utilisez la puissance des outils de bases d’unix pour effectuer cette tâche et jouissez de la commande grep et du -exec de find! 🙂

Une petite piqure de rappel au cas ou vous n’êtes pas familiers de la ligne de commande linux :

find / -exec grep -l expression_a_rechercher {} \;

19 septembre 2009 at 14 h 10 min Laisser un commentaire

Iphone simulator’s mess : get your AVFoundation audio and video working !

I got yesterday an error when playing a wav or mp sound within the Iphone simulator. My code and everything was right, but the console displayed an error about a quicktime library.

Error loading /Library/QuickTime/DivX Decoder.component/Contents/MacOS/DivX Decoder: dlopen(/Library/QuickTime/DivX Decoder.component/Contents/MacOS/DivX Decoder, 262): Symbol not found: _SCDynamicStoreCopyConsoleUser
Referenced from: /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/LangAnalysis.framework/Versions/A/LangAnalysis
Expected in: /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.2.1.sdk/System/Library/Frameworks/SystemConfiguration.framework/Versions/A/SystemConfiguration

My configuration is Macbook under Mac OS 10.5 + iphone SDK 2.2.1.

How to solve this issue ?

If you have the same kind of message, it means (as far as i understand) your iphone simulator is looking for a codec on your shared library, and found one suiting for the playing of your file, but which is not linked to your simulator.

The best way i found was to uninsall with the « DivX uninstaller » program.

If you don’t have any « DivX uninstaller », you can either:

1. Reinstall divx codecs from quicktime thirdparty code download center, and then uninstall the library using this program


2. Become root and type some rm -rf on the directory of the evil codec (something like /Library/QuickTime/DivX)

I’m now able to play wav files without any problem.Mp3 and m4v should be OK too.

7 avril 2009 at 20 h 36 min Laisser un commentaire

Animated transition between tabbar’s view on Iphone

Since last week, I’ve been attending a fantastic training course for Iphone developpement delivered by Geppy Parziale from Invasive Code.
I meet great people there, but training is now finished, and I’m on my own to develop some fresh apps!

I’ve been playing around with the Iphone SDK for the last few days. If you like « transitions » perhaps you tried to add an animation to the tab bar view. Nice transitions provide the tabbar’s item a fluent navigation. WARNING : Although i found nothing explicitely dismissing tabbar animation, it seems Apple discouraged programmers to animate tabbars view switching. Please leave a comment if you found information from Apple on this subject!

Anyway, it’s a good exercise to implement view transition to a TabBar controller. This article requires you to know how to implement the ViewController paradigm. I will not cover basic subjects like creating project, interface building, or any other ViewController related questions. If you don’t know about this, I would suggest you to attend to training courses or read some Cocoa Touch tutorials, books, and materials to be familiar with project designing.

I. Prepare your view and controller

If you are familiar with Iphone and Cocoa developpement, you probably noticed how Apple is using the delegation pattern. The project we are going to build here will follow this delegation chain:

Main application –> TabBarAppDelegate –> ViewSwitcher TabbarDelegate

To implement that, the TabBarDelegate is using the UIApplicationDelegate. The ViewSwitcherTabbarDelegate use the UITabBarController Delegate.

Create 2 or 3 viewController class, design their interface, and link them to the UITabbar’s items. Declare your UITabBarController and name it tabBarController in your application delegate .h file. When ready, just open the implementation of your TabBarAppDelegate and modify the applicationDidFinishLaunching: method as this:

-(void)applicationDidFinishLaunching:(UIApplication *)app {

tabBarController.delegate = [[ViewSwitcherTabbarDelegate alloc]init];

[window addSubview:[tabBarController view]]:

[window makeKeyAndVisible]:


Don’t forget to release the ViewSwitcherTabbarDelegate and the tabBarController in your dealloc method of the application Delegate.
Let’s talk about what we have done:
The first line of code declares we are using another class to enhance our tabBarController behaviour.
The second line is defining the first view which is appearing when bringing our tabBarController to the screen.
The third line make our window active on the screen.

II. create your animation

Jump to the ViewSwitcherTabbarDelegate implementation file. You need to implements 2 methods to get your delegate working:

These function are
– tabBarController:didEndCustomizingViewControllers:changed:
– tabBarController:didSelectViewController:

The method we are looking for is tabBarController:didSelectViewController:, because this method will be fired when the tabBarController is switching between his views.

Here is an example of the implementation of this method to animate the transition :

-(void)tabBarController:(UITabBarController *)tabBarController
// prepare your transition
CATransition *transition;
transition = [CATransition animation];
transition.type = yourtypeoftransition
transition.duration = yourduration

// prepare your view switching
[[[ViewController view]layer]addAnimation:transition forKey:nil];

When building and runnig, you should now see the transition between the view, using your animation parameters. Enjoy !

6 avril 2009 at 12 h 38 min 7 commentaires

Articles récents