How to set predefined开发者_如何转开发 macro key for NSLog(@"mytext")
typing and cursor focus and selected to edit between " mytext "
Please we use NSLog almost everywhere.
So if we get to type nslog then we will be faster.
You can check out debugging techniques with NSLog
in this article. Also I've written a short article on how to create autocompletion using macros in the first article.
This isn't a feature automatically supported in Xcode, but if you run Xcode 3, you can use Completion Dictionary by Objective Development (it's an excellent tool) to achieve the same effect. If you run Xcode 4 (which doesn't support Completion Dictionary), you're going to have to use a general macro application, such as TextExpander by SmileOnMyMac or Typinator by Ergonis
If you want to use a C macro you could do something like this:
#define nslog(x) NSLog(@ "before " #x " after" );
Then you can use it in your program like this:
nslog(test)
Which will print out:
before test after
精彩评论