Issue with UIPopoverController

Discussion in 'iPad Development' started by Sarvesh, Jun 3, 2012.

  1. Sarvesh
    Offline

    Sarvesh iPF Noob

    Joined:
    May 19, 2012
    Messages:
    3
    Thanks Received:
    0
    Trophy Points:
    0
    Location:
    Goa India
    Ratings:
    +0 / 0
    I have one UIButton on my screen. On selecting/clicking this Button I am opening list of Items in UIPopoverController. When I select item form UIPopoverController, the program works as intended without any issue. The problem occurs when instead of selecting item form UIPopoverController, if I click on screen, screen just turns blank, loosing all the content and controls from the screen. What could be the problem?
  2. Rusdev
    Offline

    Rusdev iPF Noob

    Joined:
    Jun 1, 2012
    Messages:
    3
    Thanks Received:
    0
    Trophy Points:
    0
    Ratings:
    +0 / 0
    Essentially there are two code flows:

    1. When an event occurs in the popover controller
    2. When you tap outside popover.

    In case one 1. you are dismissing the popover yourself.

    In case of 2. the popover is dismissed for you. I would look at the code which does processing of events when the popover is dismissed (there is a delegate for that) to see if you are not removing the views.

    Perhaps you have separate case for dismissed vs. selected? I would start there.
  3. Sarvesh
    Offline

    Sarvesh iPF Noob

    Joined:
    May 19, 2012
    Messages:
    3
    Thanks Received:
    0
    Trophy Points:
    0
    Location:
    Goa India
    Ratings:
    +0 / 0
    In my case problem occurs when I tap outside the popover.
    Here is the part of code from .m file

    invokeFilterModal methods brings up popover.

    -(void) invokeFilterModal:(id) sender
    {

    if (self.popoverController == nil)
    {

    m_popoverList = [[WOPopOverList alloc] init];

    UIPopoverController *popover =
    [[UIPopoverController alloc] initWithContentViewController:m_popoverList];

    popover.popoverContentSize = CGSizeMake(300.0f, 200.0f);
    popover.delegate = self;
    m_popoverList.delegate = self;

    self.popoverController = popover;
    [popover release];
    }

    CGRect popoverRect = [self.view convertRect:[btn frame]
    fromView:[btn superview]];
    popoverRect.size.width = MIN(popoverRect.size.width, 100);

    self.popoverController.delegate = self;
    [self.popoverController
    presentPopoverFromRect:CGRectMake(195,-20,100,100)
    inView:self.view
    permittedArrowDirections:UIPopoverArrowDirectionUp
    animated:YES];
    }


    - (void) ProcessAfterSelectingItem:(NSString *) filterType
    {

    if (popoverController != nil)
    {
    [popoverController dismissPopoverAnimated:YES];
    [m_btnFilter setTitle:filterType forState:UIControlStateNormal];
    if([filterType isEqualToString:@"Name"])
    m_strFilterType = @"NameWS";
    else if([filterType isEqualToString:@"Number"])
    m_strFilterType = @"NumberWS";
    }
    }


    - (BOOL)popoverControllerShouldDismissPopover:(UIPopoverController *)popoverController {
    [self.view removeFromSuperview];
    NSLog(@"popover about to be dismissed");
    return YES;
    }


    - (void)popoverControllerDidDismissPopover:
    (UIPopoverController *)popoverController
    {

    NSLog(@"popover dismissed");
    }


    - (void)setDetailItem:(id)newDetailItem {

    if (popoverController != nil) {
    [popoverController dismissPopoverAnimated:YES];
    }

    self.popoverController = nil;

    }


    Thanks
Similar Threads
  1. Jastjaga
    Replies:
    0
    Views:
    710
  2. kylian
    Replies:
    2
    Views:
    594
  3. STeBoS
    Replies:
    8
    Views:
    1,248
  4. JoshuaMoore
    Replies:
    8
    Views:
    1,110
Loading...

Share This Page

Search tags for this page

dismiss

,

uipopover blank

,

uipopovercontroller dismiss

,

uipopovercontroller tap more