MPMoviePlayerController load video from Photo library,play so fast - ios6

// CameraViewController.h
#interface CameraViewController : UIViewController{
UIImagePickerController *_picker;
}
#property (strong, nonatomic) IBOutlet UIImageView *imageView;
#property (nonatomic, retain) MPMoviePlayerController *player;
(IBAction)loadImage:(UIButton *)sender;
// CameraViewController.m
#interface CameraViewController ()
#property (strong, nonatomic) MPMoviePlayerController *playView;
#end
#implementation CameraViewController
#synthesize imageView = _imageView;
#synthesize player = _player;
#synthesize playView = _playView;
(void)viewDidLoad
{
[super viewDidLoad];
_picker = [[UIImagePickerController alloc] init];
}
(void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
}
(IBAction)loadImage:(UIButton *)sender {
_picker.delegate = self;
_picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
NSArray *mediaTypes = [NSArray arrayWithObjects:(NSString *)kUTTypeImage, (NSString *)kUTTypeMovie, nil];
_picker.mediaTypes = mediaTypes;
[self presentViewController:_picker animated:YES completion:NULL];
}
pragma mark -ImagePicker Delegate
(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
UIImage *image = nil;
NSURL *imageURL = nil;
imageURL = [info valueForKey:UIImagePickerControllerMediaURL];
if (imageURL == nil) {
image = [info valueForKey:UIImagePickerControllerEditedImage];
if (image == nil) {
image = [info valueForKey:UIImagePickerControllerOriginalImage];
_imageView.image = image;
}
else {
}
}
else {
self.player = [[MPMoviePlayerController alloc] initWithContentURL:imageURL];
[[NSNotificationCenter defaultCenter] addObserver:self selector:#selector(movieFinishedCallback:) name:MPMoviePlayerPlaybackDidFinishNotification object:self.player];
self.player.view.frame = CGRectMake(10.0, 10.0, 200.0, 200.0);
self.player.view.backgroundColor = [UIColor clearColor];
self.player.movieSourceType = MPMovieSourceTypeFile;
[self.player prepareToPlay];
[self.view addSubview:self.player.view];
[self.player play];
}
[picker dismissViewControllerAnimated:YES completion:NULL];
}
(void)imagePickerControllerDidCancel:(UIImagePickerController *)picker {
[picker dismissViewControllerAnimated:YES completion:NULL];
}
pragma mark - User Define
(void)movieFinishedCallback:(NSNotification *)notification {
MPMoviePlayerViewController *player = [notification object];
[[NSNotificationCenter defaultCenter] removeObserver:self
name:MPMoviePlayerPlaybackDidFinishNotification object:player];
[player.view removeFromSuperview];
}
The movieFinishedCallback:method will be called immediately,so the video can not play completely.
How to resolve it?

Apple suggests:
Uses AVPlayer to play videos from the iPod Library, Camera Roll, or via iTunes File Sharing.

Related

How to load URL on UITableViewCell touch

New at this, just trying to make a link load if a certain UITableView cell is touched.
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:responseData options:0 error:nil];
NSArray *deals = [dic objectForKey:#"deals"];
NSDictionary *dealOne = [deals objectAtIndex:0];
NSString *url = [dealOne objectForKey:#"url"];
UITouch *touch = [[event allTouches] anyObject];
if([touch isKindOfClass:[UITableViewCell class]])
{
UITableViewCell *cell;
CGPoint location = [touch locationInView: self.view];
cell.center = location;
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];
}
NSLog(#"TABLECELL TOUCHED");
}
Solved using the following. In this case, I wanted to have a link load when the cell was touched for "finalDealOne." When the cell is double-tapped, the link loads.
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:
{
static NSString *CellIdentifier = #"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:responseData options:0 error:nil];
NSArray *deals = [dic objectForKey:#"deals"];
NSDictionary *dealOne = [deals objectAtIndex:0];
NSString *title = [dealOne objectForKey:#"title"];
NSString *finalDealOne = [NSString stringWithFormat:#"Deal One:\n\n''%#''\n\nDouble tap here to redeem offer.",title];
(NSIndexPath *)indexPath
UITapGestureRecognizer *tapped = [[UITapGestureRecognizer alloc] initWithTarget:self action:#selector(finalDealOne)];
tapped.numberOfTapsRequired = 2;
[cell addGestureRecognizer:tapped];
}
To make this work, I included the following reference:
- (void)finalDealOne
{
NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:responseData options:0 error:nil];
NSArray *deals = [dic objectForKey:#"deals"];
NSDictionary *dealOne = [deals objectAtIndex:0];
NSString *url = [dealOne objectForKey:#"url"];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];
}

Is there a way select a specific image for use in a UITable iOS?

I have a UITable, and I like to add an image in the detail view for a cell. I can handle the selection for any image from the camera roll or from the camera:
cell.imageView.image = someImage;
But how do I define a specific image - in the case above: "someImage", so that the next time the app is run, the correct image is shown for each item.
UPDATE. This is the code I'm using to snap/select an image..
- (IBAction)btnTakePicture_Clicked:(id)sender
{
NSLog(#"%s", __FUNCTION__);
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:#"Select Image from..." delegate:self cancelButtonTitle:#"Cancel" destructiveButtonTitle:nil otherButtonTitles:#"Camera", #"Image Gallary", nil];
actionSheet.actionSheetStyle = UIActionSheetStyleBlackTranslucent;
actionSheet.alpha=0.90;
actionSheet.tag = 1;
[actionSheet showInView:self.view];
}
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
NSLog(#"%s", __FUNCTION__);
switch (actionSheet.tag)
{
case 1:
switch (buttonIndex)
{
case 0:
{
#if TARGET_IPHONE_SIMULATOR
UIAlertView* alert = [[UIAlertView alloc] initWithTitle:#"Ooops" message:#"Camera not available." delegate:nil cancelButtonTitle:#"OK" otherButtonTitles:nil];
[alert show];
#elif TARGET_OS_IPHONE
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
picker.delegate = self;
//picker.allowsEditing = YES;
[self presentViewController:picker animated:YES completion:nil];
#endif
}
break;
case 1:
{
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
picker.delegate = self;
[self presentViewController:picker animated:YES completion:nil];
}
break;
}
break;
default:
break;
}
}
-(void)imagePickerController:(UIImagePickerController*)picker didFinishPickingMediaWithInfo:(NSDictionary*)info
{
NSLog(#"%s", __FUNCTION__);
dataImage = UIImageJPEGRepresentation([info objectForKey:#"UIImagePickerControllerOriginalImage"],1);
imgPicture.image = [[UIImage alloc] initWithData:dataImage];
[picker dismissViewControllerAnimated:YES completion:nil];
}
UPDATE 2. With the help from people below, I think this solution will work for me:
- (IBAction)photoLibraryAction:(id)sender
{
int c = self.capturedImages.count;
for (int i=0; i < c; i++ ){
if (self.imageView.tag == cellTag) {
NSLog(#"found it");
} else {
NSLog(#"can't find it");
}
}
}
if ([self.capturedImages count] == 1)
{
// we took a single shot
[self.imageView setImage:[self.capturedImages objectAtIndex:0]];
[self.imageView setTag:myTag];
}
I would do in this way.
#interface CustomClassCell : UITableViewCell
#property (unsafe_unretained, nonatomic) IBOutlet UIImageView *HomePicture;
#end
#interface CustomClass : NSObject
#property (nonatomic, copy) NSString *PicPath;
#end
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
CustomClassCell *cell = [tableView dequeueReusableCellWithIdentifier:#"CustomClassCellIdentifer"];
id object = [self.tableData objectAtIndex:indexPath.row];
CustomClass *myObject = (CustomClass*)object;
cell.HomePicture.image = [UIImage imageNamed:myObject.PicPath];
return cell;
}

by Adding Polyline(path) on MKMapview crashing the app in ios6

I have a requirement to adding a path in my MKMapview between two annotation pin. There is no issue with ios 5 or older but when i try to run app in ios 6 app is surprisingly quit. below is my code. If there is any correction in my code then please suggest me.
1.So my question is suggest the best way how to decrees memory in my following code so that i can solve crash in my Application.
- (void)viewDidLoad
{
NVPolylineAnnotation *annotation = [[NVPolylineAnnotation alloc] initWithPoints:pathArray mapView:_mapView];
[_mapView addAnnotation:annotation];
[annotation release];
[pathArray removeAllObjects];
}
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation
{
NSLog(#"%s",__FUNCTION__);
if ([annotation isKindOfClass:[NVPolylineAnnotation class]])
{
NSLog(#"=========ANOTATION=========NVPolylineAnnotationView START");
//ann=[ann initWithAnnotation:annotation mapView:_mapView];
NVPolylineAnnotationView *ann=[[NVPolylineAnnotationView alloc] init];
return [[ann initWithAnnotation:annotation mapView:_mapView] autorelease];//[[[NVPolylineAnnotationView alloc] initWithAnnotation:annotation mapView:_mapView] autorelease];
}
else if([annotation isKindOfClass:[MapViewAnnotation class]])
{
MKPinAnnotationView *annView=[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:#"pointers"] ;
// annView.rightCalloutAccessoryView = [UIButton buttonWithType: UIButtonTypeDetailDisclosure];
annView.animatesDrop=NO;
annView.canShowCallout = TRUE;
return [annView autorelease];
}
else if([annotation isKindOfClass:[PlacePin class]])
{
{
MKPinAnnotationView *pinView = nil;
if(annotation != mapView.userLocation)
{
static NSString *defaultPinID = #"com.invasivecode.pin";
pinView = (MKPinAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:defaultPinID];
if ( pinView == nil )
pinView = [[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:defaultPinID] autorelease];
pinView.pinColor = MKPinAnnotationColorGreen;
pinView.canShowCallout = YES;
pinView.animatesDrop = NO;
}
else {
[mapView.userLocation setTitle:#"I am here"];
}
return pinView;
}
}
return nil;
}
- (void) mapView:(MKMapView *)mapView didAddAnnotationViews:(NSArray *)views
{
NSLog(#"%s",__FUNCTION__);
// fixes that some marker are behind the polyline
for (int i=0; i<[views count]; i++)
{
MKAnnotationView *view = [views objectAtIndex:i];
if ([view isKindOfClass:[NVPolylineAnnotationView class]])
{
[[view superview] sendSubviewToBack:view];
/* In iOS version above 4.0 we need to update the polyline view after it
has been added to the mapview and it ready to be displayed. */
NSString *reqSysVer = #"4.0";
NSString *currSysVer = [[UIDevice currentDevice] systemVersion];
if ([currSysVer compare:reqSysVer options:NSNumericSearch] != NSOrderedAscending)
{
[self updatePolylineAnnotationView];
}
}
}
NSLog(#"----------didAddAnnotationViews");
}
- (void)updatePolylineAnnotationView
{
NSLog(#"%s",__FUNCTION__);
MKAnnotationView *annotationView = [views objectAtIndex:0];
id <MKAnnotation> mp = [annotationView annotation];
[mapView selectAnnotation:mp animated:NO];
*/
for (NSObject *a in [_mapView annotations])
{
if ([a isKindOfClass:[NVPolylineAnnotation class]])
{
NVPolylineAnnotation *polyline = (NVPolylineAnnotation *)a;
NSObject *pv = (NSObject *)[_mapView viewForAnnotation:polyline];
if ([pv isKindOfClass:[NVPolylineAnnotationView class]])
{
NVPolylineAnnotationView *polylineView =
(NVPolylineAnnotationView *)[_mapView viewForAnnotation:polyline];
[polylineView regionChanged];
}
}
}
}

Using Autolayout to position UITextField next to UILabel

I would like to use auto layout to position a UITextField next to cell.textLabel when a UITableView goes into edit mode. The code that I have works correctly but I get a message in the log that says some existing constraints had to be broken.
UILabel *label = cell.textLabel;
UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(0.0, 0.0, 400.0, 22.0)];
textField.placeholder = cell.textLabel.text;
textField.translatesAutoresizingMaskIntoConstraints = NO;
textField.text = text;
[cell.contentView addSubview:textField];
[cell addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:#"H:[label]-[textField]-|"
options:0
metrics:nil
views:NSDictionaryOfVariableBindings(label,textField)]];
[cell addConstraint:[NSLayoutConstraint constraintWithItem:textField attribute:NSLayoutAttributeCenterY relatedBy:NSLayoutRelationEqual toItem:label attribute:NSLayoutAttributeCenterY multiplier:1.0 constant:0]];
Log message is:
(
"<NSAutoresizingMaskLayoutConstraint:0x1066abc0 h=--& v=--& H:[UITableViewCellContentView:0x9a7d070(934)]>",
"<NSAutoresizingMaskLayoutConstraint:0x10660a90 h=--& v=--& H:[UILabel:0x9a93ef0(914)]>",
"<NSLayoutConstraint:0x1065ea60 H:[UITextField:0x1065c660]-(NSSpace(20))-| (Names: '|':UITableViewCellContentView:0x9a7d070 )>",
"<NSAutoresizingMaskLayoutConstraint:0x10660a50 h=--& v=--& UILabel:0x9a93ef0.midX == + 467>",
"<NSLayoutConstraint:0x10669280 H:[UILabel:0x9a93ef0]-(NSSpace(8))-[UITextField:0x1065c660]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x10669280 H:[UILabel:0x9a93ef0]-(NSSpace(8))-[UITextField:0x1065c660]>
I think that this is caused by conflicting restraints with the cell.textLabel width. So my question is if there is another way to have a textfield in a standard table view cell that stretches from the textLabel width to the end of the cell without breaking default constraints. I feel like I'm close but I can't quite get there. I've searched Google over for three weeks but can't quite get my head around this. I've also watched WWDC videos on auto layout (perhaps I'm just an idiot). Thanks for your help.
Instead of trying to manipulate Apple's standard cell, I took the plunge and wrote my own UITableViewCell subclass that mimics UITableViewCellStyleValue1. When the tableview goes into edit mode, in the simplest terms I hide the value label and display the textfield. For those who might be struggling with the same thing, I'm posting some code to help you get started:
#interface NXAlphaNumericTextFieldCell : UITableViewCell<UITextFieldDelegate,NumberKeyboardDelegate>
#property (strong, nonatomic) UITextField *inputTextField;
#property (strong, nonatomic) UILabel *titleLabel;
#property (strong, nonatomic) UILabel *valueLabel;
#property (strong, nonatomic) NSArray *xTitleLabelConstraints;
#property (strong, nonatomic) NSArray *xTextFieldConstraints;
#property (strong, nonatomic) NSArray *xValueLabelConstraints;
#end
And a few methods in the implementation:
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
// Initialization code
self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 0, 44.0f)];
self.titleLabel.translatesAutoresizingMaskIntoConstraints = NO;
self.titleLabel.font = [UIFont boldSystemFontOfSize:16.0f];
self.titleLabel.backgroundColor = [UIColor clearColor];
self.valueLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 0, 44.0f)];
self.valueLabel.translatesAutoresizingMaskIntoConstraints = NO;
self.valueLabel.textColor = [UIColor colorWithRed:81.0/255.0 green:102.0/255.0 blue:145.0/255.0 alpha:1.0];
self.valueLabel.backgroundColor = [UIColor clearColor];
self.inputTextField = [[UITextField alloc] initWithFrame:CGRectMake(0, 0, 100, 44.0f)];
self.inputTextField.translatesAutoresizingMaskIntoConstraints = NO;
self.inputTextField.autocapitalizationType = UITextAutocapitalizationTypeWords;
self.inputTextField.autocorrectionType = UITextAutocorrectionTypeYes;
self.inputTextField.clearButtonMode = UITextFieldViewModeAlways;
self.inputTextField.delegate = self;
[self.contentView addSubview:self.valueLabel];
[self.contentView addSubview:self.titleLabel];
[self.contentView addSubview:self.inputTextField];
UILabel *textLabel = self.titleLabel;
NSDictionary *labelTextFieldViewsDictionary = NSDictionaryOfVariableBindings(textLabel);
self.xTitleLabelConstraints = [NSLayoutConstraint constraintsWithVisualFormat:#"|-[textLabel]"
options:0
metrics:nil
views:labelTextFieldViewsDictionary];
UITextField *textfield = self.inputTextField;
labelTextFieldViewsDictionary = NSDictionaryOfVariableBindings(textLabel, textfield);
self.xTextFieldConstraints = [NSLayoutConstraint constraintsWithVisualFormat:#"|-[textLabel]-50-[textfield]-|"
options:0
metrics:nil
views:labelTextFieldViewsDictionary];
UILabel *valueLabel = self.valueLabel;
labelTextFieldViewsDictionary = NSDictionaryOfVariableBindings(valueLabel);
self.xValueLabelConstraints = [NSLayoutConstraint constraintsWithVisualFormat:#"H:[valueLabel]-|"
options:0
metrics:nil
views:labelTextFieldViewsDictionary];
[self setNeedsUpdateConstraints];
}
return self;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
[super setSelected:selected animated:animated];
// Configure the view for the selected state
if (self.isEditing) {
[self.inputTextField becomeFirstResponder];
}
}
- (void)setEditing:(BOOL)editing animated:(BOOL)animated
{
[super setEditing:editing animated:animated];
[self addConstraints:self.xTitleLabelConstraints];
if (editing) {
if (self.inputType == kCellInputTypeAlphaNumeric) {
self.inputTextField.keyboardType = UIKeyboardTypeAlphabet;
} else if (self.inputType == kCellInputTypeEmail) {
self.inputTextField.keyboardType = UIKeyboardTypeEmailAddress;
} else if (self.inputType == kCellInputTypePhoneNumber) {
self.inputTextField.keyboardType = UIKeyboardTypeNamePhonePad;
} else {
if (!self.numberKeyboard) {
self.numberKeyboard = [[NumberKeyboard alloc] initWithNibName:#"NumberKeyboard" bundle:nil];
self.numberKeyboard.textField = self.inputTextField;
self.numberKeyboard.showsPeriod = YES;
self.numberKeyboard.delegate = self;
}
self.inputTextField.inputView = self.numberKeyboard.view;
}
self.inputTextField.text = self.valueLabel.text;
self.inputTextField.placeholder = self.titleLabel.text;
self.valueLabel.hidden = YES;
self.inputTextField.hidden = NO;
[self removeConstraints:self.xValueLabelConstraints];
[self addConstraints:self.xTextFieldConstraints];
} else {
[self.inputTextField resignFirstResponder];
self.inputTextField.hidden = YES;
self.valueLabel.hidden = NO;
[self removeConstraints:self.xTextFieldConstraints];
[self addConstraints:self.xValueLabelConstraints];
}
}
- (void)updateConstraints
{
[super updateConstraints];
if (self.editing) {
[self removeConstraints:self.xValueLabelConstraints];
[self addConstraints:self.xTextFieldConstraints];
} else {
[self removeConstraints:self.xTextFieldConstraints];
[self addConstraints:self.xValueLabelConstraints];
}
}

Custom swipe function in UITableViewCell doesn't work

I need to add the count in the uitableviewcell in a such a way that when I trigger the swipe function the count should be incremented in the corresponding cell and while tapping the count should be decremented.
(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = nil;
NSString *CellIdentifier = #"sample";
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
}
UISwipeGestureRecognizer *recognizer;
recognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:#selector(handleTapFrom:)];
[self addGestureRecognizer:recognizer];
self.tapRecognizer = (UITapGestureRecognizer *)recognizer;
recognizer.delegate = self;
[recognizer release];
recognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:#selector(handleSwipeFrom:)];
[self addGestureRecognizer:recognizer];
[recognizer release];
UILabel *cookieLabel = [[UILabel alloc] initWithFrame:CGRectMake(5,5, 120,30)];
cookieLabel.text = #"hello";
cookieLabel.font = [UIFont systemFontOfSize:15.0f];
cookieLabel.textColor = [UIColor blackColor];
cookieLabel.backgroundColor = [UIColor redColor];
[cell.contentView addSubview:cookieLabel];
[cookieLabel release];
cell.selectionStyle = UITableViewCellSelectionStyleGray;
costLabel = [[UILabel alloc] initWithFrame:CGRectMake( 200, 5, 230, 30)];
//costLabel.text = handleSwipeFrom:;
costLabel.font = [UIFont systemFontOfSize:15.0f];
costLabel.textColor = [UIColor blackColor];
costLabel.backgroundColor = [UIColor greenColor];
[cell.contentView addSubview:costLabel];
[costLabel release];
[self setUserInteractionEnabled:YES];
return cell;
}
Don't add the UISwipeGestureRecognizer to the cell. Add it to the UITableView.
I used TISwipeableTableView as a base and modified it heavily to work correctly (they did their own touch handling, which resulted in a "weird, unnative" feeling)
- (void)didSwipe:(UIGestureRecognizer *)gestureRecognizer {
if ([MRUserDefaults sharedMRUserDefaults].isSwipeMenuEnabled) {
if (gestureRecognizer.state == UIGestureRecognizerStateEnded) {
CGPoint swipeLocation = [gestureRecognizer locationInView:self];
NSIndexPath *swipedIndexPath = [self indexPathForRowAtPoint:swipeLocation];
TISwipeableTableViewCell* swipedCell = (TISwipeableTableViewCell *)[self cellForRowAtIndexPath:swipedIndexPath];
if ([swipedCell isKindOfClass:[TISwipeableTableViewCell class]]) {
if (![swipedIndexPath isEqual:indexOfVisibleBackView]) {
[self hideVisibleBackView:YES];
[swipedCell revealBackView];
[self setIndexOfVisibleBackView:swipedIndexPath];
if (swipeDelegate && [swipeDelegate respondsToSelector:#selector(tableView:didSwipeCellAtIndexPath:)]){
[swipeDelegate tableView:self didSwipeCellAtIndexPath:[self indexPathForRowAtPoint:swipeLocation]];
}
}
}
}
}
}
- (id)initWithFrame:(CGRect)frame style:(UITableViewStyle)style {
if ((self = [super initWithFrame:frame style:style])) {
if ([MRUserDefaults sharedMRUserDefaults].isSwipeMenuEnabled) {
UIGestureRecognizer *swipeGesture = [[[UISwipeGestureRecognizer alloc] initWithTarget:self action:#selector(didSwipe:)] autorelease];
[self addGestureRecognizer:swipeGesture];
}
}
return self;
}
This should get you started.
[cell addGestureRecognizer:recognizer]

Resources