UIDatePicker in UIActionSheet on iPad

后端 未结 1 1329
Happy的楠姐
Happy的楠姐 2020-12-13 21:06

In the iPhone version of my app, I have a UIDatePicker in a UIActionSheet. It appears correctly. I am now setting up the iPad version of the app, a

相关标签:
1条回答
  • 2020-12-13 21:41

    I ended up creating a separate segment of code for the iPad Popover:

    //build our custom popover view
    UIViewController* popoverContent = [[UIViewController alloc] init];
    UIView* popoverView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 344)];
    popoverView.backgroundColor = [UIColor whiteColor];
    
    datePicker.frame = CGRectMake(0, 44, 320, 300);
    
    [popoverView addSubview:toolbar];
    [popoverView addSubview:datePicker];
    popoverContent.view = popoverView;
    
    //resize the popover view shown
    //in the current view to the view's size
    popoverContent.contentSizeForViewInPopover = CGSizeMake(320, 244);
    
    //create a popover controller
    UIPopoverController *popoverController = [[UIPopoverController alloc] initWithContentViewController:popoverContent];
    
    //present the popover view non-modal with a
    //refrence to the button pressed within the current view
    [popoverController presentPopoverFromBarButtonItem:self.navigationItem.leftBarButtonItem 
                              permittedArrowDirections:UIPopoverArrowDirectionAny 
                                              animated:YES];
    
    //release the popover content
    [popoverView release];
    [popoverContent release];
    
    0 讨论(0)
提交回复
热议问题