Memory leak using datePicker.datePickerMode

I am creating a custom view that includes a date picker. My application is running slowly and the tools show that I have a memory leak. Leaking line:

datePicker.datePickerMode = UIDatePickerModeDate;

      

Any help would be greatly appreciated, I don't know why this is causing the leak. The complete method is below.

- (UIView *)createDemoView
{
    UIView *demoView = [[UIView alloc] initWithFrame:CGRectMake(10, 10, 300, 260)];
    CGRect rect = CGRectMake(0, 0, 280, 60);
    UITextView *textView = [[UITextView alloc] initWithFrame:rect];
    textView.backgroundColor=[UIColor clearColor];
    textView.font = [UIFont fontWithName:@"Cochin" size:13];
    textView.text = @"Please Enter Your Birthday";
    textView.textAlignment = NSTextAlignmentLeft;
    UIDatePicker *datePicker = [[UIDatePicker alloc] initWithFrame:CGRectMake(-18,50,162,162)]; //-10.0f, 40.0f, 130.0f, 200.0f)];
    datePicker.datePickerMode = UIDatePickerModeDate;
    [datePicker addTarget:self action:@selector(dateChanged:) forControlEvents:UIControlEventValueChanged];
    [demoView addSubview:textView];
    [demoView addSubview:datePicker];
    return demoView;
}

      

+3


source to share





All Articles