调用新视图时的 UIPopover 问题

发布于 2024-11-15 20:14:00 字数 1576 浏览 4 评论 0原文

我在 iPad 应用程序中使用 UIPopover,但是当我使用 IBAction 从此 UIPopover 调用视图时遇到问题,该视图打开但没有旋转,我可以看到预览视图在后面旋转,而 UIPOPover 仍然打开。

我的调试器控制台上出现错误:

2011-06-18 16:34:49.562 大学校友[8540:207] 观点 控制器返回 NO -shouldAutorotateToInterfaceOrientation: 适用于所有界面方向。它 应该至少支持一个 方向。 wait_fences:失败 收到回复:10004003

这是我用来打开 UIPOPOver 的 IBAction :

-(IBAction)barBtn3:(id)sender
{
    if (self.popoverController3 == nil) {
        PopOverSelfMain *selfserve = 
        [[PopOverSelfMain alloc] 
         initWithNibName:@"PopOverSelfMain" 
         bundle:[NSBundle mainBundle]]; 

    UIPopoverController *popover3 = 
    [[UIPopoverController alloc] initWithContentViewController:selfserve]; 

    popover3.delegate = self;
    [popover3 setPopoverContentSize:CGSizeMake(220, 220)];
    [selfserve release];

    self.popoverController3 = popover3;

    [popover3 release];
}


CGRect popover3Rect = [self.view convertRect:[btn3 frame] fromView:[btn3 superview]];

[self.popoverController3 presentPopoverFromRect:popover3Rect inView:self.view permittedArrowDirections:UIPopoverArrowDirectionDown animated:YES];

}

然后在 POPOver 中我使用这个方法打开一个新视图:

-(IBAction)actionevent:(id)sender{
Eventspage *listing = [[Eventspage alloc] initWithNibName:nil bundle:nil];
listing.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentModalViewController:listing animated:YES];
[listing release];

}

这是我第一次使用 POPOver 并且我错过了一些东西...... DismissPopover 可以解决这个问题吗?或者我应该使用其他方法来调用 View ?

I am using an UIPopover in my iPad aplication but I have an issue when I am calling a view from this UIPopover with a IBAction, this view open but didn´t rotate and I can see the preview view rotating behind with the UIPOPover still open.

That the error i have on my debugger console :

2011-06-18 16:34:49.562
UniversityAlumni[8540:207] The view
controller returned NO from
-shouldAutorotateToInterfaceOrientation:
for all interface orientations. It
should support at least one
orientation. wait_fences: failed to
receive reply: 10004003

Here is the IBAction i am using to open the UIPOPOver :

-(IBAction)barBtn3:(id)sender
{
    if (self.popoverController3 == nil) {
        PopOverSelfMain *selfserve = 
        [[PopOverSelfMain alloc] 
         initWithNibName:@"PopOverSelfMain" 
         bundle:[NSBundle mainBundle]]; 

    UIPopoverController *popover3 = 
    [[UIPopoverController alloc] initWithContentViewController:selfserve]; 

    popover3.delegate = self;
    [popover3 setPopoverContentSize:CGSizeMake(220, 220)];
    [selfserve release];

    self.popoverController3 = popover3;

    [popover3 release];
}


CGRect popover3Rect = [self.view convertRect:[btn3 frame] fromView:[btn3 superview]];

[self.popoverController3 presentPopoverFromRect:popover3Rect inView:self.view permittedArrowDirections:UIPopoverArrowDirectionDown animated:YES];

}

Then inside the POPOver i am using this Method to open a new view :

-(IBAction)actionevent:(id)sender{
Eventspage *listing = [[Eventspage alloc] initWithNibName:nil bundle:nil];
listing.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentModalViewController:listing animated:YES];
[listing release];

}

Is the first time i am using the POPOver and i am missing something ...
A dismissPopover can fixe this issue ? Or should i use an other method to call the View ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

没企图 2024-11-22 20:14:00

这里不直接调用“presentModalViewController”方法,而是使用 NSTimer 调用它,您的问题将得到解决。我在我的项目中解决了这个问题,因为我遇到了同样的问题。

所以,你可以在你的项目中这样做。

-(IBAction)actionevent:(id)sender{

[NSTimer scheduledTimerWithTimeInterval:0.001 target:self selector:@selector(open_EventPage) userInfo:nil repeats:NO];

}

-(void) open_EventPage
{
事件页面 *listing = [[事件页面分配] initWithNibName:nil bundle:nil];
Listing.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[自我呈现ModalViewController:列出动画:是];
【上市发布】;

如果您能解决这里的问题,请告诉我

Here instead of calling "presentModalViewController" method directly call it using NSTimer and your problem will be resolved. I solved it in my project as I was getting the same issue.

So, You can do like this here in your project.

-(IBAction)actionevent:(id)sender{

[NSTimer scheduledTimerWithTimeInterval:0.001 target:self selector:@selector(open_EventPage) userInfo:nil repeats:NO];

}

-(void) open_EventPage
{
Eventspage *listing = [[Eventspage alloc] initWithNibName:nil bundle:nil];
listing.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentModalViewController:listing animated:YES];
[listing release];
}

Let me know if you can solve the issue here.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文