IPAD must-haves. And fun-to-haves.

Brighten your iPad with a colorful cover, stream to your TV, download pictures from your digital camera, and more. There’s already so much you can do with iPad and iPad mini

Apple Wireless Keyboard

The incredibly thin Apple Wireless Keyboard uses Bluetooth technology, which makes it compatible with iPad

Apple unveils iPad mini: ‘Thin as a pencil, light as paper’

iPad inspires creativity and hands-on learning with features you won’t find in any other educational tool

Lightning connector and FaceTime HD camera

Apple announces 4th generation iPad packing an A6X CPU

Pages

Showing posts with label rotate. Show all posts
Showing posts with label rotate. Show all posts

Wednesday, March 27, 2013

How to rotate a UIImageView

Hello,

I need help to implement a function in my code xcode to rotate a single image on its own axis. The image needs to rotate to click a button and then must stop when this button is pushed again. I managed to make a schedule to do this by looking at some tutorials, but not working correctly, by clicking on the image rotacionamento this, but this also moving laterally, not just this rotating in own central axis, the image needs to be stopped and only turn. I'm using the code below to do this function. Can someone help me tweak this code or suggest any other better solution? Thank you for your help. Below the code I'm using.

 

 

In ViewController.m

/

//  ViewController.m

//  Motrista da rodada

//

//  Created by Alexsandre Andrade on 23/03/13.

//  Copyright (c) 2013 Alexsandre Andrade. All rights reserved.

//

 

#import "ViewController.h"

 

@interface ViewController ()

 

@end

 

@implementation ViewController

 

@synthesize theButton, theImageView;

 

-(void)rotateRoulette

{

    theImageViewLogo.hidden=YES;

    theImageView.hidden=NO;

    theButton.titleLabel.text = @"Parar";

    self.theImageView.center=CGPointMake(self.theImageView.center.x, self.theImageView.center.y);

    self.theImageView.transform=CGAffineTransformMakeRotation (angle);

    angle+=0.4;

}

 

 

-(IBAction)runRoulette:(id)sender

{

   

    if(!runStop)

    {

       

       

        theTimer = [NSTimer scheduledTimerWithTimeInterval:1.0/40.0 target:self selector:@selector(rotateRoulette) userInfo:nil repeats:YES];

    }

    else

    {

       

        [theTimer invalidate];

        theTimer = nil;

    }

    runStop = !runStop;

}

 

- (void)viewDidLoad

{

   

    [super viewDidLoad];

// Do any additional setup after loading the view, typically from a nib.

   

    angle = 0;

    runStop = FALSE;

   

   

}

 

- (void)didReceiveMemoryWarning

{

    [super didReceiveMemoryWarning];

    // Dispose of any resources that can be recreated.

}

 

@end

 

-------------------------------------------------------------------------------- ---------

 

In ViewController.h

 

/

//  ViewController.h

//  Motrista da rodada

//

//  Created by Alexsandre Andrade on 23/03/13.

//  Copyright (c) 2013 Alexsandre Andrade. All rights reserved.

//

 

//#import

 

//@interface ViewController : UIViewController

//@property (weak, nonatomic) IBOutlet UIImageView *seta;

//@property (weak, nonatomic) IBOutlet UIImageView *image;

 

#import

 

@interface ViewController : UIViewController

{

    IBOutlet UIImageView *theImageViewLogo;

    IBOutlet UIImageView *theImageView;

    IBOutlet UIButton    *theButton;

    NSTimer              *theTimer;

    float        angle;

    BOOL         runStop;

}

 

@property (atomic, retain) IBOutlet UIImageView *theImageView;

@property (atomic, retain) IBOutlet UIButton    *theButton;

 

-(IBAction)runRoulette:(id)sender;

 

 

 

@end

 

-------------------------------------------------------------------------------- --------------

 

 

 

 

 

thanks!!


View the original article here

Saturday, February 2, 2013

How to rotate iOS MKMapView so that it north-oriented when switching tracking mode?

I am working on an iPhone app (iOS 6.1), and I use MKMapView to display a map in my app.

I am switching between the three different map orientation modes using MKUserTrackingModeNone, MKUserTrackingModeFollow, MKUserTrackingModeFollowWithHeading and this works.

However I have a problem with the orientation of the map not resetting to north-facing orientation (north on the map being at the top of the screen) when switching from MKUserTrackingModeFollowWithHeading to MKUserTrackingModeNone.

On the built-in maps app on the ipad, the flow is like this:

  1. When you start the app it is in mode MKUserTrackingModeNone and is north-oriented
  2. When you toggle the orientation mode it changes to MKUserTrackingModeFollow, and the orientation is still north.
  3. When you switch again, it changes to MKUserTrackingModeFollowWithHeading, and the map rotates according to the direction you are facing/pointing the iPad.
  4. When you switch orientation again, it goes back to MKUserTrackingModeNone, and the map nicely rotates back to being north-oriented.

I would like my app to behave in the same way in regards to orientation when switching mode, but when I do as in step 4 above and switch from MKUserTrackingModeFollowWithHeading to MKUserTrackingModeNone, the orientation stays as it was just before making the orientation switch instead of rotating back to north orientation.

I am making the orientation switch with the standard MKUserTrackingBarButtonItem control placed in a toolbar.

Any ideas of how to solve this?

Thanks!


View the original article here

How to rotate iOS MKMapView so that it north-oriented when switching tracking mode?

I am working on an iPhone app (iOS 6.1), and I use MKMapView to display a map in my app.

I am switching between the three different map orientation modes using MKUserTrackingModeNone, MKUserTrackingModeFollow, MKUserTrackingModeFollowWithHeading and this works.

However I have a problem with the orientation of the map not resetting to north-facing orientation (north on the map being at the top of the screen) when switching from MKUserTrackingModeFollowWithHeading to MKUserTrackingModeNone.

On the built-in maps app on the ipad, the flow is like this:

  1. When you start the app it is in mode MKUserTrackingModeNone and is north-oriented
  2. When you toggle the orientation mode it changes to MKUserTrackingModeFollow, and the orientation is still north.
  3. When you switch again, it changes to MKUserTrackingModeFollowWithHeading, and the map rotates according to the direction you are facing/pointing the iPad.
  4. When you switch orientation again, it goes back to MKUserTrackingModeNone, and the map nicely rotates back to being north-oriented.

I would like my app to behave in the same way in regards to orientation when switching mode, but when I do as in step 4 above and switch from MKUserTrackingModeFollowWithHeading to MKUserTrackingModeNone, the orientation stays as it was just before making the orientation switch instead of rotating back to north orientation.

I am making the orientation switch with the standard MKUserTrackingBarButtonItem control placed in a toolbar.

Any ideas of how to solve this?

Thanks!


View the original article here