我究竟做错了什么?
NSLog 确实返回了 Swipes 的操作,但图像没有改变。我尝试了我所知道的一切。请帮忙?
我正在与 Parse.com 合作,并且我有一个 PFQueryTableView,它将一个单元格连接到一个 DetailView 控制器。该 Detail 视图有一个 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