2011-12-26 1 views

답변

1

기본적으로 예입니다. TTStyledText는 html 태그를 포함 할 수 있기 때문에 3 개의 탐색을 활용할 수 있습니다. 태그를 사용하여 img 태그를 감싸고 320의 사진 뷰어에서 파생 된 컨트롤러에 대한 매핑을 설정하면됩니다. 그 initWithPhotoUrl 내부

-(id)initWithPhotoUrl:(NSString*)photoURL { 
    self = [self initWithNibName:nil bundle:nil]; 
    if (self) { 
     NSString *unencodedURL = [photoURL gtm_stringByUnescapingFromURLArgument];//this is where you decode the string (notice we encode it in the html). Google toolbox has a nice category for Strings to encode and decode urls see: http://code.google.com/p/google-toolbox-for-mac/source/browse/trunk/Foundation/GTMNSString%2BURLArguments.h?r=373 
    } 
    return self; 
} 

:

TTNavigator* navigator = [TTNavigator navigator]; 
TTURLMap* map = navigator.URLMap; 
[map from:@"yourapp://photoViewer/(initWithPhotoUrl:)" toViewController:[TTWebController class]]; 

하여 사진보기 컨트롤러이 초기화 방법이 있어야합니다 앱 위임에

NSString* kText = @"This is a test of styled labels. <a href=\"yourapp://photo/http%3A%2F%2Fsomeserver.com%2Fsmiley.png\"><img src=\"http://someserver.com/smiley.png\"/</a>"; 
TTStyledTextLabel* label1 = [[[TTStyledTextLabel alloc] init] autorelease]; 
label1.text = [TTStyledText textFromXHTML:kText lineBreaks:YES URLs:YES]; 

이 같은 컨트롤러에 대한 매핑을 가지고 당신은 사진 소스를 만들어야합니다 - MockPhotoSource를 만드는 방법에 대한 샘플은 TTCatalog 샘플을 참조하십시오.

+0

정말 고마워요. – endy

+0

당신을 환영합니다;) –