2011-10-30 2 views
0

Three20에서보기 컨트롤러 탐색과 관련하여 질문이 있습니다. 나는 TTTableView "Gallery"와 TTPhotoViewController "Photos"를 가지고있다. 하나의 표보기 항목을 터치하면 앱이 사진보기로 이동합니다.TTTableview에서 TTPhotoView로 Three20 탐색

TTNavigator *navigator = [TTNavigator navigator]; 
navigator.supportsShakeToReload = NO; 
navigator.persistenceMode = TTNavigatorPersistenceModeAll; 


TTURLMap *map = navigator.URLMap; 
[map from:@"*" toViewController:[TTWebController class]]; 

[map from:@"tt://launcher" toSharedViewController:[LauncherViewController class]]; 

[map from:@"tt://photos" parent:@"tt://gallery" toViewController:[PhotoViewController class] selector:nil transition:0]; 
[map from:@"tt://gallery" parent:@"tt://launcher" toViewController:[GalleryViewController class] selector:nil transition:0]; 

GalleryViewController가있는 tableview 컨트롤러가 GalleryViewController.m

-(void)createModel 
{ 
    self.dataSource = [TTListDataSource dataSourceWithObjects: 
        [TTTableSubtitleItem itemWithText:@"Album One" subtitle:nil imageURL:@"http://example.image.url" URL:@"tt://photos"] 
        , 
        [TTTableSubtitleItem itemWithText:@"Album Two" subtitle:nil imageURL:@"http://example.image.url2" URL:@"tt://photos"], 
        nil]; 
} 
에서

@interface GalleryViewController : TTTableViewController 
@end 

되면, AppDelegate.m- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 방법에

: 여기

는 I 사용 코드이다

TTCatalog.xcodeproj 샘플 프로젝트에서이 코드를 복사했습니다. 하지만 사진보기를 드릴 할 수 없어서 테이블보기 항목에서 사진보기로 이동하려고 할 때 콘솔에서 다음을 얻었습니다.

nested push animation can result in corrupted navigation bar 
Finishing up a navigation transition in an Navigation Bar subview tree might get corrupted. 
Unbalanced calls to begin/end appearance transitions for <PhotoViewController: 0x6c5d8f0>. 

그래서이 질문을 해결하는 방법을 모르겠습니다. 감사!

-------- 업데이트 : ----------

나는 문제를 해결하는 방법을 알아 냈어. toSharedViewController이 문제를 해결할 수있는 이유 AppDelegate 방법에서, 대신 [map from: parent: toViewController: selector: transition:]

[map from:@"tt://launcher" toSharedViewController:[LauncherViewController class]]; 

[map from:@"tt://photos" parent:@"tt://gallery" toSharedViewController:[PhotoViewController class] selector:nil]; 
[map from:@"tt://gallery" parent:@"tt://launcher" toSharedViewController:[GalleryViewController class] selector:nil]; 

를 사용하지만, 여기에 또 다른 질문을 제공, 누군가가 설명 할 수 있습니까?

답변

0

을 사용할 필요가 없어도 - from:toViewController:을 사용해보십시오. 그 이유는 PhotoViewController으로가는 길은 간단합니다 (실행기 -> 갤러리 -> 사진). 당신이 (즉, GalleryViewController를 가리키는 당신의 PhotoViewController의 왼쪽 상단에 백 버튼을 가짐) 사이에서 GalleryViewController을 가지면서 LauncherViewController에서 직접 PhotoViewController로 이동하려는 경우를 들어

, 당신은 - from:parent:toSharedViewController:를 호출 할 .

현재, 따라서 "중첩 된 푸시"-warnings 발생하지, 공유 컨트롤러를 다시 사용하는 - from:parent:toSharedViewController:를 호출 :이 될 것이라고 의미하는 "공유"모드로 만든

컨트롤러를 한 번 생성되어 파괴 될 때까지 재사용됩니다.