Wednesday 8 August 2012

Methods for CUT, COPY n PASTE in any iPhone App.


// for cut operation

-(IBAction)cut {
  [self copy];
  textPad.text = @"";
}


// for copy operation

-(IBAction)copy {

        NSString *copyString = [[NSString alloc] initWithFormat:@"%@",[textPad text]];
        UIPasteboard *pb = [UIPasteboard generalPasteboard];
        [pb setString:copyString];
}

// for paste Operation

-(IBAction)paste {
        UIPasteboard *pb = [UIPasteboard generalPasteboard];
        textPad.text = [pb string];
}

No comments:

Post a Comment