Archive for the ‘cocoa’ Category

HowTo fit text inside a UIWebView

Monday, January 5th, 2009 Share on Twitter

If, like me, you want to make sure your text will fit inside your UIWebView (without scrolling), you can implement the following javascript: <script language='javascript' type="text/javascript"> function adjustHeight(maxHeight) { elem = document.getElementById("sign"); height = ...

Selecting an UITabBarItem in the “More…” section

Friday, December 19th, 2008 Share on Twitter

I needed to select an UITabBarItem located in the "More..." section, and I came to this solution: To select a viewController  of the tabBarController, I do the following (each tabBarItem has a tag) : - (IBAction) showAnotherTab:(id)sender { int tag = [sender tag]; NSArray *viewControllers = [self.tabBarController viewControllers]; for (int ...

Add an UIProgressView or UIActivityIndicatorView to your UIAlertView

Sunday, November 9th, 2008 Share on Twitter

This snippet shows how to add an UIProgressView to an UIAlertView. You can choose to display an UIProgressView or an UIActivityIndicatorView in the alert. This may break with a new version of the SDK (2.1 for now), but this was accepted by Apple (or they didnt see it) - (void) createProgressionAlertWithMessage:(NSString *)message withActivity:(BOOL)activity { ...

Finally

Friday, November 7th, 2008 Share on Twitter

After 14713 lines of code, here is my first iPhone application: iVault, available in the AppStore.

Bring any window to the front

Tuesday, March 4th, 2008 Share on Twitter

A question was asked on the apple dev mailing list on how to bring a window with a certain name to the front. Since I was already working on how to get the list of windows on the screen, I just added some AppleScript to bring the window to the front. This ...