2014-01-25 112 views
0

在我的應用程序中,我有一個表視圖中的項目列表。點擊其中一個,該應用程序顯示該項目的詳細信息。細節出現後,通過導航控制器的後退按鈕,應用程序返回列表。TransitionFromView崩潰 - iphone

在詳細視圖中,我實現了一個方法來滑動手勢,以便將視圖更改爲列表的第二個元素的細節等。爲了做到這一點,我在oneFingerSwipeLeft方法中使用「transitionFromView」。 aidea只在內部信息更改的情況下重複使用相同的視圖。

,通過改變視圖的方法是:

- (void)oneFingerSwipeLeft:(UITapGestureRecognizer *)recognizer { 
    int idx=currentIdx; 
    if (idx ==[todasLasTapas count]-1) { //last object vuelvo al primero 
     idx= -1; 
    } 
    ClassInfo *info =[allInfo objectAtIndex:idx+1]; 
    //VIEW CONTROLLER 
    MoreInfo *moreInfoController =[[MoreInfo alloc]initWithNibName:@"MoreInfoController" bundle:nil]; 

    //passing the details to view 
    moreInfoController.id = info.uniqueId; 
    moreInfoController.name = info.name; 
    [UIView transitionFromView:self.view 
         toView:moreInfoController.view 
         duration:1 
         options:UIViewAnimationOptionTransitionCrossDissolve 
         completion:^(BOOL finished) { 
          [self.view removeFromSuperview]; 
        }]; 
} 

它的工作原理,但只有第一個掃描指紋。在第二次刷卡應用程序崩潰時,僅顯示(lldb)輸出消息。

當我嘗試通過手指滑動對「第三個」視圖充電時,會發生崩潰。但是,試圖調試使用的NSLog,代碼不中方法

-(void)oneFingerSwipeLeft:(UITapGestureRecognizer *)recognizer 

的LLDB再次進入BT的迴應是:

(lldb) bt 
* thread #1: tid = 0x1f03, 0x0187b09b libobjc.A.dylib`objc_msgSend + 15, stop reason = EXC_BAD_ACCESS (code=2, address=0x8) 
    frame #0: 0x0187b09b libobjc.A.dylib`objc_msgSend + 15 
    frame #1: 0x00a7885a UIKit`_UIGestureRecognizerSendActions + 139 
    frame #2: 0x00a7799b UIKit`-[UIGestureRecognizer _updateGestureWithEvent:] + 333 
    frame #3: 0x00a790df UIKit`-[UIGestureRecognizer _delayedUpdateGesture] + 46 
    frame #4: 0x00a7bd2d UIKit`___UIGestureRecognizerUpdate_block_invoke_0543 + 57 
    frame #5: 0x00a7bcac UIKit`_UIGestureRecognizerRemoveObjectsFromArrayAndApplyBlocks + 331 
    frame #6: 0x00a73a28 UIKit`_UIGestureRecognizerUpdate + 1348 
    frame #7: 0x007e0972 UIKit`-[UIWindow _sendGesturesForEvent:] + 1283 
    frame #8: 0x007e0e53 UIKit`-[UIWindow sendEvent:] + 98 
    frame #9: 0x007bed4a UIKit`-[UIApplication sendEvent:] + 436 
    frame #10: 0x007b0698 UIKit`_UIApplicationHandleEvent + 9874 
    frame #11: 0x026eadf9 GraphicsServices`_PurpleEventCallback + 339 
    frame #12: 0x026eaad0 GraphicsServices`PurpleEventCallback + 46 
    frame #13: 0x019b9bf5 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 53 
    frame #14: 0x019b9962 CoreFoundation`__CFRunLoopDoSource1 + 146 
    frame #15: 0x019eabb6 CoreFoundation`__CFRunLoopRun + 2118 
    frame #16: 0x019e9f44 CoreFoundation`CFRunLoopRunSpecific + 276 
    frame #17: 0x019e9e1b CoreFoundation`CFRunLoopRunInMode + 123 
    frame #18: 0x026e97e3 GraphicsServices`GSEventRunModal + 88 
    frame #19: 0x026e9668 GraphicsServices`GSEventRun + 104 
    frame #20: 0x007adffc UIKit`UIApplicationMain + 1211 
    frame #21: 0x000184fd pruebasTapas`main(argc=1, argv=0xbffff2e0) + 141 at main.m:16 
(lldb) 

有人可以幫助我,好嗎?

+0

使用的數據視圖,請提供一個堆棧跟蹤 – rist

+0

我剛剛更新我的答案 – doxsi

回答

0

嘗試一些簡單的

-(void) viewDidLoad 
{ 
    UISwipeGestureRecognizer *swipe = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swiped)]; 
    swipe.direction = UISwipeGestureRecognizerDirectionLeft; 
    //rest of the code 
} 


-(void) swiped 
{ 
    [self viewWillAppear:YES]; 
} 

刷新你的viewWillAppear中

+0

TX在答案。你認爲重新加載視圖是什麼? – doxsi