ios - How to make UIPickerView resignFirstResponder if user clicks in other place then UIPickerView -


i have created uipickerview following . want make resignfirstresponder if user clicks in other place uipickerview how achieve that. have created uipickerview following way.where else handle

[pickerview removefromsuperview];

-(void)pickerview:(id)sender {     _items =[[nsarray alloc]initwithobjects:@"hindi",@"english",@"in city born?",              @"what childhood nickname?",              @"type own question.",nil];      pickerview=[[uipickerview alloc] initwithframe:cgrectmake(10,350,300,300)];      pickerview.transform = cgaffinetransformmakescale(0.75f, 0.75f);     pickerview.delegate = self;     pickerview.datasource = self;     pickerview.showsselectionindicator = yes;     pickerview.backgroundcolor = [uicolor lightgraycolor];     [pickerview selectrow:1 incomponent:0 animated:yes];   //  [self.view addsubview:pickerview];     [contentview addsubview:pickerview];   }  - (nsinteger)numberofcomponentsinpickerview:(uipickerview *)pickerview; {      return 1;  }  - (nsinteger)pickerview:(uipickerview *)pickerview numberofrowsincomponent:(nsinteger)component; {      return [_items count]; }  - (nsstring *)pickerview:(uipickerview *)pickerview titleforrow:(nsinteger)row forcomponent:(nsinteger)component {         return[_items objectatindex:row];  }  -(void)pickerview:(uipickerview *)pickerview didselectrow:(nsinteger)row incomponent:(nsinteger)component{     [txt_securityque settext:[_items objectatindex:row]];      nslog(@"did select"); } 

-(void)viewwillappear:(bool)animated {     [super viewwillappear:yes];      uitapgesturerecognizer *tap=[[uitapgesturerecognizer                alloc]initwithtarget:self action:@selector(tap)];     [contentview addgesturerecognizer:tap]; }  -(void)tap {     //write uipickerview resignfirstresponder code...... } 

Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -