Archive for January, 2009

Redirect NSLog to a file on the iPhone

Friday, January 9th, 2009 Share on Twitter

If you need to debug your app when disconnected from your Mac (and from the console), redirect all your NSLog calls to a file so you can later read it. The method below will create a file name "console.log" in the Documents folder of your application so you can later read ...

Macros for Xcode

Monday, January 5th, 2009 Share on Twitter

These are some of the macros I use with Xcode: CMLog: I use this macro to replace NSLog: #define CMLog(format, ...) NSLog(@"%s:%@", __PRETTY_FUNCTION__,[NSString stringWithFormat:format, ## __VA_ARGS__]); When you use this macro, it outputs text to the console, including the class and method from where it was called. So, if you call this macro ...

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 = ...