Search code examples
iosipaddatepickeruiactionsheet

How to change ActionSheetDatePicker origin on iPAD


I'm opening ActionSheetDatePicker on a table view cell tap as:

[ActionSheetDatePicker showPickerWithTitle:@"Select Date"
                       datePickerMode:UIDatePickerModeDate
                       selectedDate:[NSDate date]
                           doneBlock:^(ActionSheetDatePicker *picker, id selectedDate, id origin) {                                                     dateString = [dateFormatter stringFromDate:selectedDate];
                                [self fetchHistoryForDate];
                                }
              cancelBlock:^(ActionSheetDatePicker *picker) {
                           NSLog(@"Block Picker Canceled");}
                                                origin:tableView];

But it shows like this on iPAD. enter image description here How can I change it's direction? I'm using ActionSheetPicker-3.0


Solution

  • To fix this try to change origin argument like this.

    [ActionSheetDatePicker showPickerWithTitle:@"Select Date"
                           datePickerMode:UIDatePickerModeDate
                           selectedDate:[NSDate date]
                               doneBlock:^(ActionSheetDatePicker *picker, id selectedDate, id origin) {                                                     dateString = [dateFormatter stringFromDate:selectedDate];
                                    [self fetchHistoryForDate];
                                    }
                  cancelBlock:^(ActionSheetDatePicker *picker) {
                               NSLog(@"Block Picker Canceled");}
                                                    origin:tableView.tableFooterView];