0

내가 뭘 잘못하고 있니?제스처 인식기 PFImageView

NSLog는 스 와이프의 동작을 반환하지만 이미지는 변경되지 않습니다. 내가 아는 모든 것을 시도했습니다. 도와주세요?

저는 Parse.com에서 작업 중이며 셀을 DetailView Controller에 연결하는 PFQueryTableView가 있습니다. 그 디테일 뷰는 PFImageView를 가지고 있으며, Parse Data Browser (같은 클래스)에서 호출 된 다른 이미지로 스 와이프해야합니다.

내하는 .m 코드 : 같은 일에 도움이 필요한 사람들을위한

#import "BellezaDetailViewController.h" 
    #import "BellezaView.h" 

    @interface BellezaDetailViewController() 

    @end 

    @implementation BellezaDetailViewController 

    @synthesize lookPhoto, bellezaView, activityIndicator; 


    - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil 
    { 
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; 
if (self) { 
    // Custom initialization 
} 
return self; 
    } 

    - (void)handleSwipe:(UISwipeGestureRecognizer *)swipe { 

if (swipe.direction == UISwipeGestureRecognizerDirectionLeft) { 
    NSLog(@"Left Swipe"); 
} 

if (swipe.direction == UISwipeGestureRecognizerDirectionRight) { 
    NSLog(@"Right Swipe"); 
} 

    } 

    - (void)viewDidLoad 
    { 
[super viewDidLoad];{ 

    [activityIndicator startAnimating]; 

    [activityIndicator performSelector:@selector(removeFromSuperview) withObject:nil afterDelay:10]; 

    NSLog(@"Downloading Look"); 

    self.lookPhoto.file = bellezaView.imagenDos; 
    [lookPhoto loadInBackground]; 

    UISwipeGestureRecognizer *swipeLeft = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipe:)]; 



    UISwipeGestureRecognizer *swipeRight = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipe:)]; 

    // Setting the swipe direction. 
    [swipeLeft setDirection:UISwipeGestureRecognizerDirectionLeft]; 



    [swipeRight setDirection:UISwipeGestureRecognizerDirectionRight]; 

    // Adding the swipe gesture on image view 
    [lookPhoto addGestureRecognizer:swipeLeft]; 


    [lookPhoto addGestureRecognizer:swipeRight]; 

} 

    } 


    - (void)swipeRecognized:(UISwipeGestureRecognizer *)swipe{ 

if(swipe.direction == UISwipeGestureRecognizerDirectionLeft){ 
    self.lookPhoto.file = bellezaView.imagenTienda; 
    [lookPhoto loadInBackground]; 
} 

if(swipe.direction == UISwipeGestureRecognizerDirectionRight){ 
    self.lookPhoto.file = bellezaView.imagenTienda; 
    [lookPhoto loadInBackground]; 
} 

      } 

    - (void)viewDidUnload { 

[self setLookPhoto:nil]; 

[super viewDidUnload]; 

    } 


    - (void)didReceiveMemoryWarning 
    { 
[super didReceiveMemoryWarning]; 
// Dispose of any resources that can be recreated. 
    } 

    @end 
+0

코드를 편집했습니다. 해당 행을 추가하십시오. 또한 Imageview의 userInteractionEnabled 속성이 NO로 설정된 것 같습니다. 이것을 YES로 설정하십시오. – Funny

+0

시간 내 주셔서 감사합니다! 나는 나의 실수를 발견했다! 작업 세트가 잘못되어 핸들을 호출하지 않았습니다. 동일한 작업에 도움이 필요한 사람에게. 이것은 내 오류입니다. UISwipeGestureRecognizer * swipeLeft = [[UISwipeGestureRecognizer alloc] initWithTarget : self action : @selector (* * handleSwipe ** :)]; - (공극) ** ** swipeRecognized :(UISwipeGestureRecognizer *) 와이프 { (swipe.direction == UISwipeGestureRecognizerDirectionLeft 있으면) { self.lookPhoto.file = bellezaView.imagenTienda; [lookPhoto loadInBackground]; } 굵은 글씨는 일치해야합니다. – adriennemhenry

답변

0

..이 내 오류였다

액션과 핸들러는 일치해야 (지금 가 ... *이 일치해야 * 사이에서 무엇

UISwipeGestureRecognizer swipeLeft = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(**handleSwipe**:)]; 


    - (void)**swipeRecognized**:(UISwipeGestureRecognizer *)swipe{ if(swipe.direction == UISwipeGestureRecognizerDirectionLeft){ self.lookPhoto.file = bellezaView.imagenTienda; [lookPhoto loadInBackground]; } 

) 잘 작동합니다.