ios - App crashing without stacktrace on pickerview with textfield -
i'm still working on getting uipickerview when trying edit textfield, app crashes without stacktrace. instead of stacktrace shows usual ((lldb)) , nothing
#import "testviewcontroller.h" #import "findclasses.h" @interface testviewcontroller () @property uipickerview *picker; @property nsarray *pickerarray; @property (nonatomic, strong) findclasses *finder; @end @implementation testviewcontroller @synthesize finder = _finder; - (findclasses *)finder { if (!_finder) _finder = [[findclasses alloc] init]; return _finder; } - (void)viewdidload { [super viewdidload]; self.pickerarray = [self.finder findclassesintimetable]; self.classfield.delegate = self; self.picker = [[uipickerview alloc] init]; self.picker.delegate = self; self.picker.datasource = self; self.classfield.inputview = self.picker; // additional setup after loading view. } - (bool)textfieldshouldbeginediting:(uitextfield *)textfield { [textfield becomefirstresponder]; return yes; } - (bool)textfieldshouldreturn:(uitextfield *)textfield { return yes; } - (void)didreceivememorywarning { [super didreceivememorywarning]; // dispose of resources can recreated. } #pragma mark - uipickerview method implementation -(nsinteger)numberofcomponentsinpickerview:(uipickerview *)pickerview{ return 1; } -(nsinteger)pickerview:(uipickerview *)pickerview numberofrowsincomponent:(nsinteger)component{ return self.pickerarray.count; } -(nsstring *)pickerview:(uipickerview *)pickerview titleforrow:(nsinteger)row forcomponent:(nsinteger)component{ return [self.pickerarray objectatindex:row]; }
does why keeps happening? thanks.
i faced similar issue , resolved including code.
- (bool)textfieldshouldreturn:(uitextfield *)textfield { [self. textfield resignfirstresponder]; //once user clicks return field on number pad, resignsfirstresponder "textfield" double delayinseconds = 0.3; //set delaytimer .3 seconds dispatch_time_t poptime = dispatch_time(dispatch_time_now, delayinseconds * nsec_per_sec); //set pop time dispatch_after(poptime, dispatch_get_main_queue(), ^(void){ [self openpickerview]; }); //open pickerview after .3 sec time delay return yes; //bool function hence return either true or false. in case, true. } - (void)openpickerview { [uiview beginanimations:nil context:nil]; //begin animation set nil [uiview setanimationduration:0.3]; //animation duration in 0.3 sec pickerviewcontainer.frame=cgrectmake(0, 200, 320, 261); //open picker view mentioned x axis,y axis, width,height details [uiview commitanimations]; //commit animation }
Comments
Post a Comment