Ios 滑动手势识别器PFImageView
我做错了什么 NSLog会返回刷卡操作,但图像不会更改。。我知道的都试过了。请帮忙 我正在Parse.com上工作,我有一个PFQueryTableView,它将一个单元格分隔为一个DetailView控制器。这个细节视图有一个PFImageView,我需要它滑动到从Parse Data Browser同一类调用的不同图像 这是我的.m代码:Ios 滑动手势识别器PFImageView,ios,uiimageview,parse-platform,uiswipegesturerecognizer,detailview,Ios,Uiimageview,Parse Platform,Uiswipegesturerecognizer,Detailview,我做错了什么 NSLog会返回刷卡操作,但图像不会更改。。我知道的都试过了。请帮忙 我正在Parse.com上工作,我有一个PFQueryTableView,它将一个单元格分隔为一个DetailView控制器。这个细节视图有一个PFImageView,我需要它滑动到从Parse Data Browser同一类调用的不同图像 这是我的.m代码: #import "BellezaDetailViewController.h" #import "BellezaView.h"
#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
对于在同一件事上需要帮助的人。。这是我的错误: 操作和处理程序应该匹配:现在可以正常工作了
UISwipeGestureRecognizer swipeLeft = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(**handleSwipe**:)];
- (void)**swipeRecognized**:(UISwipeGestureRecognizer *)swipe{ if(swipe.direction == UISwipeGestureRecognizerDirectionLeft){ self.lookPhoto.file = bellezaView.imagenTienda; [lookPhoto loadInBackground]; }
中间是什么*…*应该匹配。我已经编辑了您的代码。请尝试添加那一行。另外,Imageview的userInteractionEnabled属性似乎设置为“否”。请将其设置为“是”。谢谢您的时间!我发现了我的错误!!动作设置是错误的,没有要求控制:对于在同一件事情上需要帮助的任何人。。这是我的错误:UISwipeLeft=[[UISwipeGestureRecognitzer alloc]initWithTarget:self action:@selectorhandleSwipe:];-void**swipererecognized*:uiswipgestureerecognizer*swipe{ifswipe.direction==uiswipgestureerecognizerdirectionleft{self.lookPhoto.file=bellezaView.imagenTienda;[lookPhoto loadInBackground];}粗体应该匹配。