iphone – pop视图定位的问题

iphone – pop视图定位的问题,第1张

概述当我在iPad中纵向切换到横向视图(& Vice Versa)时,我的d出视图的位置会出现乱码.这是我如何计算我的popover视图的框架: aRect = self.myElement.frame;aRect.origin.x += aRect.size.width;[aPopOver presentPopoverFromRect:aRect inView:self.myElement.s 当我在iPad中纵向切换到横向视图(& Vice Versa)时,我的d出视图的位置会出现乱码.这是我如何计算我的popover视图的框架:

aRect = self.myElement.frame;aRect.origin.x += aRect.size.wIDth;[aPopOver presentPopoverFromrect:aRect inVIEw:self.myElement.supervIEw permittedArrowDirections:UIPopoverArrowDirectionRight animated:YES];

请告诉我这里有什么问题?

解决方法 好的,我注意到你的代码有些奇怪.

你是否有任何理由将宽度的大小添加到aRect的x位置的原点?
aRect.origin.x = aRect.size.wIDth;

我假设你想要这个是右上角….

您可以取消注释.m文件中的代码并使其如下所示:

// OverrIDe to allow orIEntations other than the default portrait orIEntation.- (BOol)shouldautorotatetoInterfaceOrIEntation:(UIInterfaceOrIEntation)interfaceOrIEntation {     Return YES; // for supported orIEntations    //otherwise return (interfaceOrIEntation == UIInterfaceOrIEntationLandscape); if you want only landscape mode.}

或者如果你想布局子视图我会在你的情况下做什么是使用dIDRotateFromIntferfaceOrIEntation:像这样:

(voID) dIDRotateFromInterfaceOrIEntation:(UIInterfaceOrIEntation)interfaceOrIEntation{    [self layoutSubvIEws];}

还有layoutSubvIEws

- (voID)layoutSubvIEws{    NSLog(@"layoutSubvIEws called");    ...recalc rects etc based on the new self.vIEw.bounds...}

它的工作原理如此.

PK

总结

以上是内存溢出为你收集整理的iphone – pop视图定位的问题全部内容,希望文章能够帮你解决iphone – pop视图定位的问题所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1080412.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-27
下一篇 2022-05-27

发表评论

登录后才能评论

评论列表(0条)

保存