OpenFlow:如何设置框架在横向模式下正确显示?
我尝试在横向模式下使用 AFOpenFlowView,但出现黑色条纹,就好像框架设置为不超过状态栏,或者更好的是,不超过状态栏处于纵向模式的框架。
这是我正在使用的代码:
CGRect applicationFrame = [[UIScreen mainScreen] bounds];
AFOpenFlowView *af = [[AFOpenFlowView alloc] initWithFrame:CGRectMake(0, 0, applicationFrame.size.height, applicationFrame.size.width)];
[af setBackgroundColor:[UIColor whiteColor]];
NSString *imageName;
for (int i = 0; i < 9; i++) {
imageName = [[NSString alloc] initWithFormat:@"picture_%d.png", i];
[af setImage:[UIImage imageNamed:imageName] forIndex:i];
[imageName release];
}
[af setNumberOfImages:9];
[af setViewDelegate:self];
[self setView:af];
[af release];
这是一张显示发生情况的图像:
I'm trying to use the AFOpenFlowView in landscape mode, but I get a black stripe as if the frame was set not go over the status bar or, better, not over the frame where the status bar is in portrait mode.
Here's the code I'm using:
CGRect applicationFrame = [[UIScreen mainScreen] bounds];
AFOpenFlowView *af = [[AFOpenFlowView alloc] initWithFrame:CGRectMake(0, 0, applicationFrame.size.height, applicationFrame.size.width)];
[af setBackgroundColor:[UIColor whiteColor]];
NSString *imageName;
for (int i = 0; i < 9; i++) {
imageName = [[NSString alloc] initWithFormat:@"picture_%d.png", i];
[af setImage:[UIImage imageNamed:imageName] forIndex:i];
[imageName release];
}
[af setNumberOfImages:9];
[af setViewDelegate:self];
[self setView:af];
[af release];
Here's an image to show what happens:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
applicationFrame.size.height
将为您提供减去状态栏的高度。它不考虑您的手机处于横向模式。
只需添加大小为 480 x 300。
您可以尝试以下调试语句:
The
applicationFrame.size.height
will give you the height minus the status bar.It does no take in consideration that your phone is in landscape mode.
Just add the size as 480 x 300.
Can you try the following debug statement:
非常抱歉耽误您的时间。最后我发现了解决方案是什么:我使用应用程序框架初始化窗口,即而
不是使用正确的代码
I'm extremely sorry for taking your time. At the end I found out what the solution was: I was initializing the window with the application frame, i.e.
instead of using the right code