如何解决UIPopover问题调用新视图时
我在iPad应用程序中使用了UIPopover,但是当我从带有IBAction的UIPopover调用视图时,出现了一个问题,该视图已打开但没有旋转,并且可以看到预览视图向后旋转,而UIPOPover仍然打开。 我在调试器控制台上遇到的错误: 2011-06-18 16:34:49.562 UniversityAlumni [8540:207]视图 控制器从传回NO -应该AutorotatetoInterfaceOrientation: 适用于所有界面方向。它 应该支持至少一个 取向。 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?
解决方法
在这里,无需使用NSTimer直接调用\“ presentModalViewController \”方法,而是可以解决您的问题。我遇到了同样的问题,因此在我的项目中解决了该问题。
因此,您可以在项目中这样做。
-(IBAction)actionevent:(id)sender {
[NSTimer scheduledTimerWithTimeInterval:0.001 target:self selector:@selector(open_EventPage) userInfo:nil repeats:NO];
}
-(无效)open_EventPage
{
Eventspage * listing = [[Eventspage alloc] initWithNibName:nil bundle:nil];
listing.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[自身presentModalViewController:列出动画:是];
[上市发布];
}
让我知道您是否可以在这里解决问题。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。