. h
#import <UIKit/UIKit.h>@interface Rootviewcontroller:uiviewcontroller< Uiactionsheetdelegate,uiimagepickercontrollerdelegate,uinavigationcontrollerdelegate>{ * ImageView;}
. m
- (void) viewdidload{[Super Viewdidload]; //Do any additional setup after loading the view.Self.title=@"picture gestures, uploading photos"; //initializing the background map[self initbackgroundview]; }#pragma-mark-functions-(void) initbackgroundview{ImageView=[[uiimageview Alloc]initwithframe:cgrectmake ( -, Max, $, Max)]; Imageview.backgroundcolor=[Uicolor Redcolor]; [Self.view Addsubview:imageview]; [ImageView Setuserinteractionenabled:yes]; UITapGestureRecognizer* Clickgesture =[[UITapGestureRecognizer alloc]initwithtarget:self Action: @selector (clickgesture:)]; [ImageView addgesturerecognizer:clickgesture];}#pragma-mark-doclickactions-(void) Clickgesture: (uigesturerecognizer*) gesture{Uiactionsheet*actionsheet = [[Uiactionsheet alloc]initwithtitle:@"Select a picture source" Delegate: Self Cancelbuttontitle:@"Cancel"Destructivebuttontitle:@"Take Pictures"Otherbuttontitles:@"Local Albums", nil]; [Actionsheet ShowInView:self.view];}#pragma-mark uiactionsheetdelegate-(void) Actionsheet: (Uiactionsheet *) Actionsheet Clickedbuttonatindex: (nsinteger) buttonindex{NSLog (@"--buttonindex-%i", Buttonindex); Uiimagepickercontroller*pickview =[[Uiimagepickercontroller alloc]init]; Pickview.Delegate=Self ; if(buttonindex==0&&!target_iphone_simulator) { //CameraPickview.sourcetype =Uiimagepickercontrollersourcetypecamera; [Self Presentviewcontroller:pickview animated:no completion:nil]; }Else if(buttonindex==1){ //albumsPickview.sourcetype =uiimagepickercontrollersourcetypephotolibrary; [Self Presentviewcontroller:pickview animated:no completion:nil]; }}#pragma-mark-uiimagepickercontrollerdelegate-(void) Imagepickercontroller: (Uiimagepickercontroller *) Picker Didfinishpickingmediawithinfo: (NSDictionary *) info{UIImage* Image =[Info objectforkey:uiimagepickercontrolleroriginalimage]; [ImageView Setimage:image]; [Picker Dismissviewcontrolleranimated:no Completion:nil]; }-(void) Imagepickercontrollerdidcancel: (Uiimagepickercontroller *) picker{[picker dismissviewcontrolleranimated:no Completion:nil]; }
Add gestures to pictures, upload photos