I have a IBAction method which is called when a button touched. But when the UIViewController is called, that IBAction method is called first before viewdidload. I checked my code, there is nowhere that I call IBAction method specificly.
What is the reason that method called before viewdidload? Why does it happen?
Thank you. .h
@interface VC_PatientInfo : M_SwipeInterface
.m
@implementation VC_PatientInfo
static M_PatientRow* patient;
NSMutableArray*activeDrugList;
NSInteger orderId;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
+(NSInteger)getOrderId{
return orderId;
}
+(void)setOrderId:(NSInteger)oId{
orderId=oId;
}
- (void)viewDidLoad
{
orderId=0;
[super viewDidLoad];
patient= [VC_PatientList getPatient];
activeDrugList = [[NSMutableArray alloc]init];
activeDrugList=[DAO_GetPatientActiveDrugs drug:[VC_Login getGuid] visit_id:[VC_PatientList getPatient].visit_id];
if([VC_Login is_from_monitoring]){
[DAO_InsertMonitoriingList patient:[VC_Login getGuid] pId:[self.pId_lbl.text integerValue]];
[self.txt_monitoring setText:@"Takip Listemden Çıkar"];
self.txt_monitoring.textColor= [UIColor redColor];
}
// Do any additional setup after loading the view.
}
+(NSMutableArray*)refreshActiveDrugs{
activeDrugList=[DAO_GetPatientActiveDrugs drug:[VC_Login getGuid] visit_id:[VC_PatientList getPatient].visit_id];
return activeDrugList;
}
+(NSMutableArray*)getActiveDrugList{
return activeDrugList;
}
- (IBAction)call_DrugOrder:(id)sender {
[Global setVC:@"vc_drugorder"];
[self callVC];
}
- (IBAction)setMonitoringList:(id)sender {
if([self.txt_monitoring.text isEqualToString:@"text1"]){
[DAO_InsertMonitoriingList patient:[VC_Login getGuid] pId:[self.pId_lbl.text integerValue]];
[self.txt_monitoring setText:@"text2"];
self.txt_monitoring.textColor= [UIColor redColor];
}else{
[DAO_RemoveMonitoriingList patient:[VC_Login getGuid] pId:[self.pId_lbl.text integerValue]];
[self.txt_monitoring setText:@"text1"];
self.txt_monitoring.textColor= [Global colorWithHexString:@"99CC00"];
}
}
- (IBAction)setViewSecret:(id)sender {
if(self.viewSecret.frame.size.height==143 )
[self.viewSecret setFrame:CGRectMake(self.viewSecret.frame.origin.x,
self.viewSecret.frame.origin.y,
self.viewSecret.frame.size.width,
0)];
else
[self.viewSecret setFrame:CGRectMake(self.viewSecret.frame.origin.x,
self.viewSecret.frame.origin.y,
self.viewSecret.frame.size.width,
143)];
}
- (IBAction)goBack:(id)sender {
[self dismissViewControllerAnimated:NO completion:nil];
}
- (IBAction)callAllergyVC:(id)sender {
[Global setVC:@"vc_patientallergy"];
[self callVC];
}
- (IBAction)callDiagnosisVC:(id)sender {
[Global setVC:@"vc_patientdiagnosis"];
[self callVC];
}
- (IBAction)callVCOldOrder:(id)sender {
[Global setVC:@"vc_oldorder"];
[self callVC];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end