1

In my program have table view.it has custom cell.

this custom cell has non editable textview.

when i touch this textview, popover popup. it working well in ios6 simulator.

but ios5.1 simulator not working. it gives this error message.

* Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIPopoverController presentPopoverFromRect:inView:permittedArrowDirections:animated:]: Popovers cannot be presented from a view which does not have a window.'

in my custom cell view i put this code for touch event

ViewControllerDateIpcker *popView =[[ViewControllerDateIpcker alloc]init];
    popView.datedelegate = self;
    _popover =[[UIPopoverController alloc]initWithContentViewController:popView];

    [_popover presentPopoverFromRect:[_txtDate bounds]
                              inView:_txtDate
            permittedArrowDirections:UIPopoverArrowDirectionAny
                            animated:YES];
Suravi
  • 301
  • 1
  • 7
  • 21

2 Answers2

0

try this :

ViewControllerDateIpcker *popView =[[ViewControllerDateIpcker alloc]init];
        popView.datedelegate = self;
_popover =[[UIPopoverController alloc]initWithContentViewController:popView];

[_popover presentPopoverFromRect:[_txtDate bounds]
                                  inView:self.view
                permittedArrowDirections:UIPopoverArrowDirectionAny
                                animated:YES];
Jay Gajjar
  • 2,661
  • 2
  • 21
  • 35
  • it gives error Property 'view' not found on object of type 'CellEdit*'. CellEdit is my custom cell – Suravi Nov 08 '13 at 09:00
  • then pass self.contentView. or you can pass the main uiview of the uiviewcontroller – Jay Gajjar Nov 08 '13 at 09:01
  • i pass viewcontroller view to my cell and set it.now it work without app crashing.but it not coming from textview.it coming top of my viewcontroller – Suravi Nov 08 '13 at 09:12
  • what about cell.contentView ? – Jay Gajjar Nov 08 '13 at 09:15
  • in my table view has editable textview also.think it is text view one.popover textview is text view two.first i edit textview one.after i click text view two(key board that time pop up) the app crash.in ios6 simulator automatically keyboard hide and popup my popview. – Suravi Nov 08 '13 at 09:27
0

It is problem of bounds only. You need to provide a view which has bounds. You should try these answers. It has worked for me as well. https://stackoverflow.com/a/8416003/1372368 or https://stackoverflow.com/a/4512944/1372368

Community
  • 1
  • 1
Kumar Aditya
  • 1,097
  • 1
  • 8
  • 19