'Tutorials'에 해당되는 글 1건

  1. 2010/10/12 jams [iOS] 로그 찍기 간략화 - by Vincent Gable

개발 하다 보면 포매팅 스타일로 로그 찍는것도 여간 귀찮은 일이 아닌데..

오늘 좋은걸 하나 발견해서 바로 써먹었당;;

디따 간단함..

* 어떤 기능?

LOG_EXPR(self.window.screen);

self.window.screen = <UIScreen: 0x6d20780; bounds = {{0, 0}, {320, 480}}; mode = <UIScreenMode: 0x6d20c50; size = 320.000000 x 480.000000>>

LOG_EXPR(self.tabBarController.viewControllers);

self.tabBarController.viewControllers = (
“<UINavigationController: 0xcd02e00>”,
“<SavingsViewController: 0xcd05c40>”,
“<SettingsViewController: 0xcd05e90>”
)

Pretty straightforward, really. The biggest convenience so far is having the expression printed out, so you don’t have to write out a name redundantly in the format string (eg. NSLog(@"actionURL = %@", actionURL)). But LOG_EXPR really shows it’s worth when you start using scalar or struct expressions:

LOG_EXPR(self.window.windowLevel);

self.window.windowLevel = 0.000000

LOG_EXPR(self.window.frame.size);

self.window.frame.size = {320, 480}


* 어떻게 바로 써먹징?

Using LOG_EXPR() in Your Project

Download VTPG_Common.m and VTPG_Common.h from my github repository, and add them to your Xcode project.

Now just add the line #import "VTPG_Common.h" to your prefix file (named <ProjectName>_Prefix.pch by default), after the #ifdef __OBJC__, for example:

#ifdef __OBJC__
    #import <Foundation/Foundation.h>
    // maybe other files, depending on project  template...
    #import "VTPG_Common.h"
#endif

Now LOG_EXPR() will work everywhere in your project.

* 원문 url


http://vgable.com/blog/2010/08/19/the- ··· -written
2010/10/12 18:19 2010/10/12 18:19
받은 트랙백이 없고, 댓글이 없습니다.

댓글+트랙백 RSS :: http://jams.pe.kr/rss/response/4

댓글+트랙백 ATOM :: http://jams.pe.kr/atom/response/4