Guest User

Untitled

a guest
Dec 11th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. - (UIView *)inputAccessoryView {
  2. if (!inputAccessoryView) {
  3. CGRect accessFrame = CGRectMake(0.0, 0.0, 380.0, 215.0);
  4. inputAccessoryView = [[UIView alloc] initWithFrame:accessFrame];
  5. UIDatePicker *picker = [[UIDatePicker alloc] init];
  6. picker.datePickerMode = UIDatePickerModeTime;
  7.  
  8. UIBarButtonItem *flexSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:self action:nil];
  9.  
  10. UIBarButtonItem *closeButton = [[UIBarButtonItem alloc] initWithTitle:@"Done" style:UIBarButtonItemStyleBordered target:self.parentViewController action:@selector(setBlackoutPeriod:)];
  11.  
  12. //closeButton.tag = indexPath.row;
  13.  
  14. UIToolbar *pickerDateToolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, -44, 320, 44)];
  15. pickerDateToolbar.barStyle = UIBarStyleBlackTranslucent;
  16. [pickerDateToolbar sizeToFit];
  17. [pickerDateToolbar setItems:[[NSArray alloc] initWithObjects:flexSpace,closeButton, nil] animated:YES];
  18.  
  19. [inputAccessoryView addSubview:picker];
  20. [inputAccessoryView addSubview:pickerDateToolbar];
  21. }
  22. return inputAccessoryView;
  23. }
Add Comment
Please, Sign In to add comment