设备方向分析

4

我正在考虑是否在我的应用程序中实现横屏模式。有没有一种分析软件可以告诉我用户是否尝试在横屏模式下查看我的应用程序?还是说我应该编写自己的方法?


你应该根据ViewController上的控件数量(如按钮、文本框、标签等)来决定它们的布局,以便用户更容易操作,并在使用应用程序时获得良好的外观和体验。 - Suraj Mirajkar
您可以为UIInterfaceOrientationLandscapeLeft、UIInterfaceOrientationLandscapeRight和UIInterfaceOrientationPortrait等方向提供支持,以便用户可以在所有方向中使用应用程序。 - Suraj Mirajkar
是的,但在实际编码之前,我想知道用户是否真正需要它。 - Elmo
3个回答

2

很难确定 shouldAutorotateToInterfaceOrientation: 调用是否针对所有方向,无论用户是否尝试进入横屏模式,并且 willRotate/didRotate 回调仅针对支持的方向进行。你可以做的是记录

[[UIDevice currentDevice] orientation];

在每个shouldAutorotateToInterfaceOrientation方法中调用。或者注册UIDeviceOrientationDidChangeNotification通知。这将返回一个UIDeviceOrientation,无论您的视图控制器的方向如何。请注意,这与UIViewControllers用于interfaceOrientation属性的UIInterfaceOrientation值不同。

typedef enum {
   UIDeviceOrientationUnknown,
   UIDeviceOrientationPortrait,
   UIDeviceOrientationPortraitUpsideDown,
   UIDeviceOrientationLandscapeLeft,
   UIDeviceOrientationLandscapeRight,
   UIDeviceOrientationFaceUp,
   UIDeviceOrientationFaceDown
} UIDeviceOrientation;

尽管这两者有关联:
typedef enum {
   UIInterfaceOrientationPortrait           = UIDeviceOrientationPortrait,
   UIInterfaceOrientationPortraitUpsideDown = UIDeviceOrientationPortraitUpsideDown,
   UIInterfaceOrientationLandscapeLeft      = UIDeviceOrientationLandscapeRight,
   UIInterfaceOrientationLandscapeRight     = UIDeviceOrientationLandscapeLeft
} UIInterfaceOrientation;

我知道如何编写代码。但是当你有一个大型应用程序时,如果用户希望它支持其他方向,分析它会很好。我正在寻找类似Cyprian指出的分析工具。 - Elmo
我使用Flurry,它是免费的,易于使用且功能强大。http://www.flurry.com/product/analytics/index.html - jbat100
我认为它不支持方向?除非我编写方向发现代码并添加日志事件以发送到Flurry。 - Elmo
当您收到设备方向更改通知时,只需记录一个Flurry事件即可。三行代码而已。根据您想要跟踪的用户数量,Heatma可能高达每月65美元。Flurry是免费的。 - jbat100

2
您可以使用 heatma.ps SDK 查看您的应用程序每个屏幕的统计数据。它是自动的,因此您不必实现方向支持即可找到答案。

太好了。这样我就不必编写其他界面方向来知道用户是否需要它了? - Elmo
是的,它可以发现用户是否尝试在横屏模式下查看您的应用程序,即使您没有实现该功能。 - Cyprian

0

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接