Saturday, 29 June 2013

How to use Swipe Gesture Recognizer iPhone ?

ViewController.h

@interface CoRoViewController : UIViewController<UIGestureRecognizerDelegate>

{
    UISwipeGestureRecognizer *gesture;


}

ViewController.m

-(void)viewDidLoad
{

 /* SWIPE GESTURE CODE */
    
    gesture = [[UISwipeGestureRecognizer alloc]init];
    [gesture setDirection:UISwipeGestureRecognizerDirectionLeft]; // you can use right or left ;)
    [gesture addTarget:self action:@selector(methodcalled)];
    
    gesture.delegate  = self;
    [self.view addGestureRecognizer:gesture];
}

-(void)methodcalled
{
      // Code you want to perform
}

Have fun :)

How to hide Navigation Bar ?

- (void)viewWillAppear:(BOOL)animated
{
    [self.navigationController setNavigationBarHidden:YES animated:animated];
    [super viewWillAppear:animated];
}

- (void)viewWillDisappear:(BOOL)animated
{
    [self.navigationController setNavigationBarHidden:NO animated:animated];
    [super viewWillDisappear:animated];
}

How to show Hidden Files on Mac ?

Open Terminal and write command :

defaults write com.apple.Finder AppleShowAllFiles TRUE
killall Finder

To hide the files once again :

defaults write com.apple.Finder AppleShowAllFiles FALSE
killall Finder