0 Replies
      Latest reply on Nov 7, 2019 12:24 PM by Rahul88
      Rahul88 Level 1 Level 1 (0 points)

        I'm making use of UIPopoverPresentationController in order to present a UITableViewController as its contentViewController on an iPad. In the process, I have noticed that the contentViewController i.e UITableViewController is unable to present itself fully, in that the navigation items that it has, are not being shown. The 2 nav items are of type UIBarButtonItem, one for editing the rows of the tableView, and the other for adding a new row.

        Here is the code-

        -(IBAction)showAssetTypePicker:(UIButton *)sender{
            NSLog(@"AssetTypePicker button pressed!!");
            assetTypePicker= [[AssetTypePicker alloc] init];
            [self.view endEditing:YES];
            NSLog(@"current item's assetType- %@",_item.assetType);
            [assetTypePicker setItem:_item];
            /*Bronze Challenge*/
            if ([[UIDevice currentDevice] userInterfaceIdiom]== UIUserInterfaceIdiomPad) {
                [assetTypePicker.tableView setDelegate:self];//Setting DetailViewController as UITableView's delegate
                assetTypePicker.modalPresentationStyle= UIModalPresentationPopover;
                [self presentViewController:assetTypePicker animated:YES completion:nil];
                //Configuring the PopoverPresentationController
                assetTypePickerPopover= assetTypePicker.popoverPresentationController;
                NSLog(@"assetTypePickerPopover- %@",assetTypePickerPopover);
                [assetTypePickerPopover setDelegate:self];
                assetTypePickerPopover.sourceView= sender;
                assetTypePickerPopover.sourceRect= sender.bounds;
                assetTypePickerPopover.permittedArrowDirections= UIPopoverArrowDirectionAny;
            else{//..for iPhone
                [self.navigationController pushViewController:assetTypePicker animated:YES];



               In the above code snippet, the AssetTypePicker is a UITableViewController which is to presented on both iPad and iPhone. For the iPhone, I have had it presented straightaway by pushing it onto an existing viewcontroller, and it takes effect when the user taps a UIButton. For the iPad, there is "assetTypePickerPopover" of type UIPopoverPresentationController, that is being used.


        The result is a popover that gets presented upon tapping of a UIButton, but without the UIBarButtonItems that constitute the navigation items of the AssetTypePicker.



        Whereas, on the iPhone, the navigation items are being shown as-



        If anyone could advice on how to work through this, i'd be grateful.