What's new
Apple iPad Forum 🍎

Welcome to the Apple iPad Forum, your one stop source for all things iPad. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Issue with UIPopoverController

Sarvesh

iPF Noob
Joined
May 19, 2012
Messages
3
Reaction score
0
Location
Goa India
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?
 

Rusdev

iPF Noob
Joined
Jun 1, 2012
Messages
3
Reaction score
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.
 
OP
S

Sarvesh

iPF Noob
Joined
May 19, 2012
Messages
3
Reaction score
0
Location
Goa India
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
 

Most reactions

Latest posts

Top