Search Results

Search found 186 results on 8 pages for 'swipe'.

Page 1/8 | 1 2 3 4 5 6 7 8  | Next Page >

  • Move a sphere along the swipe?

    - by gameOne
    I am trying to get a sphere curl based on the swipe. I know this has been asked many times, but still it's yearning to be answered. I have managed to add force on the direction of the swipe and it works near perfect. I also have all the swipe positions stored in a list. Now I would like to know how can the curl be achieved. I believe the the curve in the swipe can be calculated by the Vector dot product If theta is 0, then there is no need to add the swipe. If it is not, then add the curl. Maybe this condition is redundant if I managed to find how to curl the sphere along the swipe position The code that adds the force to sphere based on the swipe direction is as below: using UnityEngine; using System.Collections; using System.Collections.Generic; public class SwipeControl : MonoBehaviour { //First establish some variables private Vector3 fp; //First finger position private Vector3 lp; //Last finger position private Vector3 ip; //some intermediate finger position private float dragDistance; //Distance needed for a swipe to register public float power; private Vector3 footballPos; private bool canShoot = true; private float factor = 40f; private List<Vector3> touchPositions = new List<Vector3>(); void Start(){ dragDistance = Screen.height*20/100; Physics.gravity = new Vector3(0, -20, 0); footballPos = transform.position; } // Update is called once per frame void Update() { //Examine the touch inputs foreach (Touch touch in Input.touches) { /*if (touch.phase == TouchPhase.Began) { fp = touch.position; lp = touch.position; }*/ if (touch.phase == TouchPhase.Moved) { touchPositions.Add(touch.position); } if (touch.phase == TouchPhase.Ended) { fp = touchPositions[0]; lp = touchPositions[touchPositions.Count-1]; ip = touchPositions[touchPositions.Count/2]; //First check if it's actually a drag if (Mathf.Abs(lp.x - fp.x) > dragDistance || Mathf.Abs(lp.y - fp.y) > dragDistance) { //It's a drag //Now check what direction the drag was //First check which axis if (Mathf.Abs(lp.x - fp.x) > Mathf.Abs(lp.y - fp.y)) { //If the horizontal movement is greater than the vertical movement... if ((lp.x>fp.x) && canShoot) //If the movement was to the right) { //Right move float x = (lp.x - fp.x) / Screen.height * factor; rigidbody.AddForce((new Vector3(x,10,16))*power); Debug.Log("right "+(lp.x-fp.x));//MOVE RIGHT CODE HERE canShoot = false; //rigidbody.AddForce((new Vector3((lp.x-fp.x)/30,10,16))*power); StartCoroutine(ReturnBall()); } else { //Left move float x = (lp.x - fp.x) / Screen.height * factor; rigidbody.AddForce((new Vector3(x,10,16))*power); Debug.Log("left "+(lp.x-fp.x));//MOVE LEFT CODE HERE canShoot = false; //rigidbody.AddForce(new Vector3((lp.x-fp.x)/30,10,16)*power); StartCoroutine(ReturnBall()); } } else { //the vertical movement is greater than the horizontal movement if (lp.y>fp.y) //If the movement was up { //Up move float y = (lp.y-fp.y)/Screen.height*factor; float x = (lp.x - fp.x) / Screen.height * factor; rigidbody.AddForce((new Vector3(x,y,16))*power); Debug.Log("up "+(lp.x-fp.x));//MOVE UP CODE HERE canShoot = false; //rigidbody.AddForce(new Vector3((lp.x-fp.x)/30,10,16)*power); StartCoroutine(ReturnBall()); } else { //Down move Debug.Log("down "+lp+" "+fp);//MOVE DOWN CODE HERE } } } else { //It's a tap Debug.Log("none");//TAP CODE HERE } } } } IEnumerator ReturnBall() { yield return new WaitForSeconds(5.0f); rigidbody.velocity = Vector3.zero; rigidbody.angularVelocity = Vector3.zero; transform.position = footballPos; canShoot =true; isKicked = false; } }

    Read the article

  • Endless iPad Swipe?

    - by Clemens
    Hi, i want to implement a ipad view, where i parse an xml file and put the entries side by side on an "endless" ipad view, so you have to swipe through it left and right. could someone tell me how i can implement this? which type of view do i have to use? thanks in advance regards

    Read the article

  • Android Swipe In Unity 3D World with AR

    - by Christian
    I am working on an AR application using Unity3D and the Vuforia SDK for Android. The way the application works is a when the designated image(a frame marker in our case) is recognized by the camera, a 3D island is rendered at that spot. Currently I am able to detect when/which objects are touched on the model by raycasting. I also am able to successfully detect a swipe using this code: if (Input.touchCount > 0) { Touch touch = Input.touches[0]; switch (touch.phase) { case TouchPhase.Began: couldBeSwipe = true; startPos = touch.position; startTime = Time.time; break; case TouchPhase.Moved: if (Mathf.Abs(touch.position.y - startPos.y) > comfortZoneY) { couldBeSwipe = false; } //track points here for raycast if it is swipe break; case TouchPhase.Stationary: couldBeSwipe = false; break; case TouchPhase.Ended: float swipeTime = Time.time - startTime; float swipeDist = (touch.position - startPos).magnitude; if (couldBeSwipe && (swipeTime < maxSwipeTime) && (swipeDist > minSwipeDist)) { // It's a swiiiiiiiiiiiipe! float swipeDirection = Mathf.Sign(touch.position.y - startPos.y); // Do something here in reaction to the swipe. swipeCounter.IncrementCounter(); } break; } touchInfo.SetTouchInfo (Time.time-startTime,(touch.position-startPos).magnitude,Mathf.Abs (touch.position.y-startPos.y)); } Thanks to andeeeee for the logic. But I want to have some interaction in the 3D world based on the swipe on the screen. I.E. If the user swipes over unoccluded enemies, they die. My first thought was to track all the points in the moved TouchPhase, and then if it is a swipe raycast into all those points and kill any enemy that is hit. Is there a better way to do this? What is the best approach? Thanks for the help!

    Read the article

  • Why Swipe left doesn't work? [on hold]

    - by Hitesh
    I wrote the below code to detect and perform a sprite action on the single tap and swipe right event. @Override public boolean onSceneTouchEvent(Scene pScene, TouchEvent pSceneTouchEvent) { float x = 0F; int tapCount = 0; boolean playermoving = false; // TODO Auto-generated method stub if (pSceneTouchEvent.getAction() == MotionEvent.ACTION_MOVE) { if (pSceneTouchEvent.getX() > x) { playermoving = true; players.runRight(); } if (pSceneTouchEvent.getX() < x) { Log.i("Run Left", "SPRITE Left"); } /* * if (pSceneTouchEvent.getX() < x) { System.exit(0); * Log.i("SWIPE left", "SPRITE LEFT"); } */ } if (pSceneTouchEvent.getAction() == MotionEvent.ACTION_DOWN) { playermoving = false; x = pSceneTouchEvent.getX(); tapCount++; Log.i("X CORD", String.valueOf(x)); } if (pSceneTouchEvent.isActionDown()) { if (tapCount == 1 && playermoving != true) { tapCount = 0; players.jumpRight(); } } return true; } The code works fine. The only problem is that the swipe left event is not being detected due to some reasons. What can i do to make the swipe left action work? Please help

    Read the article

  • Where to start on creating finger swipe navigation in an collection of items

    - by Thomas Stock
    Lets say I want to make a control to select any integer number by dragging on a "bar" with numbers: (156 is selected) Mousedown on "159" and dragging towards the left and then doing mouseup changes the control to this: (160 is selected) I've been experimenting for the past 3 hours but I'm inexperienced in Silverlight so I'm having problems getting started. My current guess is I should seperate this into 2 steps: Step 1: Build this control without swiping behavior. Just 2 buttons to go up a number or go down a number Step 2: Replace the buttons by handling mouse events. With my limited knowledge I think I would manage building a crappy control that does this, with very messy xaml and c# and lots of headaches when trying to apply styling and fancy state transitions, but I was hoping some xaml wizards could get me started with the basic approach? Edit: This is an implementation of what I'm trying to achieve in Silverlight: Iphone's datepicker:

    Read the article

  • Moving the Gallery view to the next image on one swipe in Android?

    - by sunil
    Hi All, I have four images in the Gallery View. When we do swipe from left to right or right to left the Gallery View moves all the images i.e if I swipe from left to right from the first image then it will move to all the four images. What I want is that when I swipe it should only move to the next image. Can someone let me know how is this possible? Hope to get a reply soon. Regards Sunil

    Read the article

  • Modify or disable Windows 8 swipe gestures on touchpad / laptop

    - by Matsemann
    I have an ASUS G75VW laptop with a Synaptic touchpad (/trackpad). When I move my finger from one edge towards the middle (the swipe), Windows 8 will bring up different stuff. This is a problem because the area where I can actually move the mouse with my finger is too small (or, I mostly use the top left of the touchpad). So I often end up doing a swipe and bringing up some menu, or to do the swipe so slow that no menu is appearing but the mouse pointer is also not moving when I move my finger. Quite annoying. When swiping from left edge it earlier swapped apps like crazy. I disabled that, so now it only brings up the same menu as pressing win+tab (or some times the charms bar, I never know which). I could change that by: Win+I - Change PC settings - General - When I swipe from the left edge, switch directly to my most recent app I've tried Mouse settings in Control Panel, driver settings for my touchpad and searching for swipe and gestures on my computer (which was what led me to the setting above) with no luck. How can I disable the swipe gestures, or change what they do? Thanks.

    Read the article

  • Increase animation speed according to the swipe speed in unity for Android

    - by rohit
    I have the animation done through Maya and brought the FBX file to unity. Here is my code to calculate the speed of the swipe: Vector2 speedMeasuredInScreenWidthsPerSecond =(Input.touches[0].deltaPosition / Screen.width) * Input.touches[0].deltaTime; Now I wanted to take speedMeasuredInScreenWidthsPerSecond and use it to increase the animation speed accordingly like this: animation["gmeChaAnimMiddle"].speed=Mathf.Round(speedMeasuredInScreenWidthsPerSecond); However, this results in an error that I need to convert Vector2 to float. So how do I overcome it?

    Read the article

  • Leaked Gmail for Android Version 4.2 Features Pinch-to-Zoom and Swipe-to-Delete [Video]

    - by Jason Fitzpatrick
    If you love keeping an eye at what’s around the corner, this video showcases some of the new features in Gmail for Android–there’s even an APK for those adventurous readers who want to try it. Courtesy of AndroidPolice, we’re treated to the above video showcasing Gmail for Android’s new look and features–including pinch-to-zoom and a swipe-to-delete (or archive), similar to the notification dismissal in Android Jelly Bean. If you’re up for a little unofficial app installation, you can even hit up the link below to check out the full writeup and grab a copy of the unofficial installer. Exclusive: Upcoming Gmail For Android 4.2 Will Finally Have Pinch-To-Zoom, Swipeaway Delete/Archive [AndroidZoom] HTG Explains: What is the Windows Page File and Should You Disable It? How To Get a Better Wireless Signal and Reduce Wireless Network Interference How To Troubleshoot Internet Connection Problems

    Read the article

  • Gateway NE56R & mouse swipe gesture...how to disable?

    - by Anders
    Can anyone tell me how to shut off the swipe gesture mechanism on my computer? It's driving me crazy. I cannot use a single application without having my computer screen minimize every time I move my hand over the mouse following a mouse-click, pointer movement, etc. Having to maximize my spreadsheets, documents, and applications so much is undercutting my productivity. How some software engineer/inventor imagined that this mouse/gesture swipe gimmick would be helpful to computer users is inconceivable to me. It is a massive annoyance. I've found instructions online for disabling this obnoxious feature, but all the instructions involve messing with my registry, which I don't want to do. I will be SO GRATEFUL to any techie who can tell me how to disable this horrible mouse swipe mechanism without having to alter my registry! I'm using a Gateway NE56R Notebook, Windows 7 operating system, and an Inland USB Mouse (model no. 37535). Thank you in advance!

    Read the article

  • rotating circle with swipe question

    - by Joe
    Okay so I'm making something that basically works as a knob, but only half on the screen -- so I just need horizontal swipes to cause it to rotate. I have it nearly all sorted with one exception: if you change direction of your swipe in mid-swipe, the rotation doesn't change direction. I even can see the problem, but not sure what to do about a solution. So in my touchesMoved, I get the swipe into radians in the predictable way: CGFloat radians = atan2f(location.y - centerY, location.x - centerX); I then store radians, add/subtract it to previous rotation and then give the result to the CATransform3D. So the prob is that even though the swipe changes direction, there is a "balance" which doesn't allow an immediate change of direction. Does this make any sense?

    Read the article

  • Windows 8 trackpad edge swipe zones

    - by askvictor
    I'm running Windows 8 on a Lenovo x220 laptop; and have just inadvertently discovered the edge-swipe feature or that brings up the charms or switches between desktop and RT. Only problem is that the landing zones are a little too wide for my liking - I'd like to keep this feature, but to narrow the zone where it can start. I'd rather not disable it completely as per: Modify or disable Windows 8 swipe gestures on touchpad / laptop The Synaptic driver (latest available) doesn't seem to provide for changing this (though it does for other zones). Any ideas?

    Read the article

  • jQuery mobile swipe spamming and animation

    - by halliewuud
    I have say 5 list items with images inside placed 200px from eachother. I am trying to animate these list items to slide horizontally left if one presses a link with the id = #next or if one swipes left. And vice versa for sliding the list items right. Every click or swipe results in a slide animation of 200px on every list item. I ran into a problem where spamming the #next or #prev button would cancel the current animation and start a new one. This results in list items not sliding 200px+200px+200... but something like this 200px+140px+120... This because like I said the animation is cut and therefore the sliding distance will be shorter. Now I solved this for the clicking event by disabling the button before the animation starts and then re'enabling it on the end callbak function. But this problem is remaining for the swipe event. How can I solve this problem for the swipe event?

    Read the article

  • Where to start on creating finger swipe navigation trough a list.

    - by Thomas Stock
    Lets say I want to make a control to select any integer number by dragging on a "bar" with numbers: (156 is selected) Mousedown on "159" and dragging towards the left and then doing mouseup changes the control to this: (160 is selected) I've been experimenting for the past 3 hours but I'm inexperienced in Silverlight so I'm having problems getting started. My current guess is I should seperate this into 2 steps: Step 1: Build this control without swiping behavior. Just 2 buttons to go up a number or go down a number Step 2: Replace the buttons by handling mouse events. With my limited knowledge I think I would manage building a crappy control that does this, with very messy xaml and c# and lots of headaches when trying to apply styling and fancy state transitions, but I was hoping some xaml wizards could get me started with the basic approach? Edit: This is an implementation of what I'm trying to achieve in Silverlight: Iphone's datepicker:

    Read the article

  • Open source system for swipe card access?

    - by Moduspwnens
    We're looking at replacing our campus-wide magnetic swipe card system with something more robust. The "programmer" side of me says there's got to be an open-source, scalable solution that already does this, but all I've been able to find are proprietary vendor-specific solutions. Ideally, it'd have the following: Based on some open standard that allows us to select from a wide selection of card readers (like IMAP or HTTP) Support different kinds of card access (magnetic strip, RFIDs, etc.) Future-proof (to the extent possible) The lack of information I'm finding leads me to believe I'm not searching for the right things... or such a solution doesn't exist. Is there not some basic, open-source solution to this (like MySQL for databases, or Moodle for an LMS, or Apache for a web server)?

    Read the article

  • Listview Swipe inside viewflipper

    - by Faisal Abid
    Im trying to swipe left and right on a listview and get the viewflipper to swtich. Just like the remeberthemilk app and the default news and weather app on the nexus one (Swiping through news topics). Using various tutorials ive found , i came across on one stackoverflow that shows how to implement a swipe gesture class MyGestureDetector extends SimpleOnGestureListener { @Override public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { try { if (Math.abs(e1.getY() - e2.getY()) > SWIPE_MAX_OFF_PATH) return true; // right to left swipe if(e1.getX() - e2.getX() > SWIPE_MIN_DISTANCE && Math.abs(velocityX) > SWIPE_THRESHOLD_VELOCITY) { } else if (e2.getX() - e1.getX() > SWIPE_MIN_DISTANCE && Math.abs(velocityX) > SWIPE_THRESHOLD_VELOCITY) { viewFlipper.setInAnimation(slideRightIn); viewFlipper.setOutAnimation(slideRightOut); viewFlipper.showPrevious(); } } catch (Exception e) { // nothing } return true; } } And i got this working by doing lstView.setOnTouchListener(gestureListener); However sometimes what would happen is the listview setOnItemClickListener would be fired when the person is swiping. How do i prevent this from happening, and only get the setOnItemClickListener fired when the user actually clicks on it list item and not just swiping on it. Thanks, Faisal Abid

    Read the article

  • PCI-DSS compliance for business with only swipe terminals [migrated]

    - by rowatt
    I support the IT infrastructure for a small retail business which is now required to undergo a PCI-DSS assessment. The payment service and terminal provider (Streamline) has asked that we use Trustwave to do the PCI-DSS certification. The problem I face is that if I answer all questions and follow Trustwave's requirements to the letter, we will have to invest significantly in networking equipment to segment LANs and /or do internal vulnerability scanning, while at the same time Streamline assures me that the terminals we have (Verifone VX670-B and MagIC3 X-8) are secure, don't store any credit card information and are PCI-DSS compliant so by implication we don't need to take any action to ensure their network security. I'm looking for any suggestions as to how we can most easily meet the networking requirements for PCI-DSS. Some background on our current network setup: single wired LAN, also with WiFi turned on (though if this creates any PCI-DSS complexities we can turn it off). single Netgear ADSL router. This is the only firewall we have in place, and the firewall is out the box configuration (i.e. no DMZ, SNMP etc). Passwords have been changed though :-) a few windows PCs and 2 windows based tills, none of which ever see any credit card information at all. two swipe terminals. Until a few months ago (before we were told we had to be PCI-DSS certified) these terminals did auth/capture over the phone. Streamline suggested we moved to their IP Broadband service, which instead uses an SSL encrypted channel over the internet to do auth/capture, so we now use that service. We don't do any ecommerce or receive payments over the internet. All transactions are either cardholder present, or MOTO with details given over phone and typed direct into terminal. We're based in the UK. As I currently understand it we have three options in order to get PCI-DSS certification. segment our network so the POS terminals are isolated from all PCs, and set up internal vulnerability scanning on that network. don't segment the network, and have to do more internal scanning and have more onerous management of PCs than I think we need (for example, though the tills are Windows based, they are fully managed so I have no control over software update policies, anti virus etc). All PCs have anti virus (MSE) and windows updates automatically applied, but we don't have any centralised go back to auth/capture over phone lines. I can't imagine we are the first merchant to be in this situation. I'm looking for any recommendations a simple, cost effective way to be PCI-DSS compliant - either by doing 1 or 2 above with (hopefully) simple and inexpensive equipment/software, or any other ways if there's a better way to do this. Or... should we just go back to the digital stone age and do auth/capture over the phone, which means we don't need to do anything on our network to be PCI-DSS certified?

    Read the article

  • Swipe the more than 2 Views?

    - by Silent
    - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { if (dirString) { CATransition *animation = [self getAnimation:dirString]; [[self superview] exchangeSubviewAtIndex:0 withSubviewAtIndex:1]; [[[self superview] layer] addAnimation:animation forKey:kAnimationKey]; } } Hello all Im trying to work with the code above it may look familiar its from the Iphone Developer Cookbook, Erica Sandun what im trying to implement are 5 different views using her swipe method the code above has a transition between 2 views only, how would i change the code so i can swipe through all five views, example: view starts on view 1 then user swipes right then changes to view 2 and so forth and backward your help is much appreciated

    Read the article

  • Android, FragmentActivity and prevent Swipe

    - by FIG-GHD742
    I use android.support.v4.app.FragmentActivity for create a app with multi fragment/panels that can be access by drag/swipe between different part of the app. In one of my fragment I has a zoomable view and my problem is in case I is on the zoomable view I will prevent the use for drag/swipe to a other fragment. I has try to hack into android.support.v4.view.ViewPager for get the action from on Touch event but not work. I has try all of this case but not work: (All code is a a part of subclass to android.support.v4.view.ViewPager) Case 1: // Not working @Override protected void onPageScrolled(int position, float offset, int offsetPixels) { if (isPreventDrag()) { super.onPageScrolled(position, 1, 0); } else { super.onPageScrolled(position, offset, offsetPixels); } } Case 2: // Work but stop all event include the event to the target image view. @Override public boolean onInterceptTouchEvent(MotionEvent ev) { switch (ev.getAction()) { case MotionEvent.ACTION_DOWN: lastX = ev.getX(); // float lockScroll = false; return super.onInterceptTouchEvent(ev); case MotionEvent.ACTION_MOVE: this.lockScroll = this.isPreventDrag(); break; } if (lockScroll) { ev.setLocation(lastX, ev.getY()); return super.onInterceptTouchEvent(ev); } else { return super.onInterceptTouchEvent(ev); } } Case 3: // Work good, but by some unknown error I can drag the screen // some pixels before this stop the event. @Override public boolean onTouchEvent(MotionEvent ev) { if (this.isPreventDrag()) { return true; } else { return super.onTouchEvent(ev); } } I want a easy way to deactivate stop or deactivate if the use is allow to switch to a other Fragment. Here is a working code for me, I don't know what error I do before. // This work for me, @Override public boolean onInterceptTouchEvent(MotionEvent ev) { if (this.isPreventDrag()) { return false; } else { return super.onInterceptTouchEvent(ev); } }

    Read the article

  • xCode: iPhone Swipe Gesture crash

    - by David DelMonte
    I have an app that I'd like the swipe gesture to flip to a second view. The app is all set up with buttons that work. The swipe gesture though causes a crash ( “EXC_BAD_ACCESS”.). The gesture code is: - (void)handleSwipe:(UISwipeGestureRecognizer *)recognizer { NSLog(@"%s", __FUNCTION__); switch (recognizer.direction) { case (UISwipeGestureRecognizerDirectionRight): [self performSelector:@selector(flipper:)]; break; case (UISwipeGestureRecognizerDirectionLeft): [self performSelector:@selector(flipper:)]; break; default: break; } } and "flipper" looks like this: - (IBAction)flipper:(id)sender { FlashCardsAppDelegate *mainDelegate = (FlashCardsAppDelegate *)[[UIApplication sharedApplication] delegate]; [mainDelegate flipToFront]; } flipToBack (and flipToFront) look like this.. - (void)flipToBack { NSLog(@"%s", __FUNCTION__); BackViewController *theBackView = [[BackViewController alloc] initWithNibName:@"BackView" bundle:nil]; [self setBackViewController:theBackView]; [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:1.0]; [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:window cache:YES]; [frontViewController.view removeFromSuperview]; [self.window addSubview:[backViewController view]]; [UIView commitAnimations]; [frontViewController release]; frontViewController = nil; [theBackView release]; // NSLog (@" FINISHED "); } Maybe I'm going about this the wrong way... All ideas are welcome...

    Read the article

  • Swipe left/right to push next/previous details view

    - by Youssef
    I am working on a ios application, using storyboard. I have a simple table view with rows. Each row has a "key" string to identify it. When the user clicks on a row I push the next view "DetailsViewController" and pass the "key" as a parameter in the prepareForSegue method. The data in the second view will change based on the "key" passed. In the "DetailsViewController" I want to add a swipe gesture, when the user swipes right, I want to push the next details view. It will be as if he clicked on the next row in the table view. So to rephrase, the user has 2 ways of switching between items: he can click the item in the table view and the details view will show, he can then go back and select another item. Or he can click on a row, and in the details view he can swipe left and right to see the previous/next item. i added the uigesture recognizer: UISwipeGestureRecognizer *recognizer; recognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipe:)]; [recognizer setDirection:UISwipeGestureRecognizerDirectionRight]; [[self view] addGestureRecognizer:recognizer]; - (void) handleSwipe:(UISwipeGestureRecognizer *) sender { //I want to go to the next item in the tableview } I hope I was clear. Thank you.

    Read the article

  • UIScrollView without paging but with touchesmoved

    - by BittenApple
    I have a UIScrollView that I use to display PDF pages in. I don't want to use paging (yet). I want to display content based on touchesmoved event (so after horizontal swipe). This works (sort of), but instead of catching a single swipe and showing 1 page, the swipe seems to gets broken into 100s of pieces and 1 swipe acts as if you're moving a slider! I have no clue what am I doing wrong. Here's the experimental "display next page" code which works on single taps: - (void)nacrtajNovuStranicu:(CGContextRef)myContext { CGContextTranslateCTM(myContext, 0.0, self.bounds.size.height); CGContextScaleCTM(myContext, 1.0, -1.0); CGContextSetRGBFillColor(myContext, 255, 255, 255, 1); CGContextFillRect(myContext, CGRectMake(0, 0, 320, 412)); size_t brojStranica = CGPDFDocumentGetNumberOfPages(pdfFajl); if(pageNumber < brojStranica){ pageNumber ++; } else{ // kraj PDF fajla, ne listaj dalje. } CGPDFPageRef page = CGPDFDocumentGetPage(pdfFajl, pageNumber); CGContextSaveGState(myContext); CGAffineTransform pdfTransform = CGPDFPageGetDrawingTransform(page, kCGPDFCropBox, self.bounds, 0, true); CGContextConcatCTM(myContext, pdfTransform); CGContextDrawPDFPage(myContext, page); CGContextRestoreGState(myContext); //osvjezi displej [self setNeedsDisplay]; } Here's the swiping code: - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { [super touchesBegan:touches withEvent:event]; UITouch *touch = [touches anyObject]; gestureStartPoint = [touch locationInView:self]; } - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *touch = [touches anyObject]; CGPoint currentPosition = [touch locationInView:self]; CGFloat deltaX = fabsf(gestureStartPoint.x - currentPosition.x); CGFloat deltaY = fabsf(gestureStartPoint.y - currentPosition.y); if (deltaX >= kMinimumGestureLength && deltaY <= kMaximumVariance) { [self nacrtajNovuStranicu:(CGContextRef)UIGraphicsGetCurrentContext()]; } } The code sits in UIView which displays the PDF content, perhaps I should place it into UIScrollView or is the "display next page" code wrong?

    Read the article

1 2 3 4 5 6 7 8  | Next Page >