如何侦听iphone设备方向改变事件,以及如何添加事件的处理事件
2011-11-04 10:44
253 查看
添加侦听IPhone,ipad设备方向改变事件的方法
参考代码:
[[NSNotificationCenterdefaultCenter]
addObserver: self
selector:@selector(orientationChanged)
name:UIDeviceOrientationDidChangeNotificationobject:
nil];
/*
设备方向改变后添加的处理事件
*/
- (void) orientationChanged
{
UIDeviceOrientation deviceOrientation = [[UIDevice currentDevice] orientation];//获取当前设备的方向
}
/*
设备可能的方向
*/
typedefenum {
UIDeviceOrientationUnknown,
UIDeviceOrientationPortrait, // Device oriented vertically, home button on the bottom
UIDeviceOrientationPortraitUpsideDown, // Device oriented vertically, home button on the top
UIDeviceOrientationLandscapeLeft, // Device oriented horizontally, home button on the right
UIDeviceOrientationLandscapeRight, // Device oriented horizontally, home button on the left
UIDeviceOrientationFaceUp, // Device oriented flat, face up
UIDeviceOrientationFaceDown // Device oriented flat, face down
} UIDeviceOrientation;
THE END!
2011-11-04
参考代码:
[[NSNotificationCenterdefaultCenter]
addObserver: self
selector:@selector(orientationChanged)
name:UIDeviceOrientationDidChangeNotificationobject:
nil];
/*
设备方向改变后添加的处理事件
*/
- (void) orientationChanged
{
UIDeviceOrientation deviceOrientation = [[UIDevice currentDevice] orientation];//获取当前设备的方向
}
/*
设备可能的方向
*/
typedefenum {
UIDeviceOrientationUnknown,
UIDeviceOrientationPortrait, // Device oriented vertically, home button on the bottom
UIDeviceOrientationPortraitUpsideDown, // Device oriented vertically, home button on the top
UIDeviceOrientationLandscapeLeft, // Device oriented horizontally, home button on the right
UIDeviceOrientationLandscapeRight, // Device oriented horizontally, home button on the left
UIDeviceOrientationFaceUp, // Device oriented flat, face up
UIDeviceOrientationFaceDown // Device oriented flat, face down
} UIDeviceOrientation;
THE END!
2011-11-04
相关文章推荐
- VS2010不能添加变量 双击不能添加处理事件 以及如何添加窗口系统事件
- 第三课:获取系统设备的状态,以及系统设备状态改变事件处理
- C#如何添加鼠标滚轮事件以及判断鼠标滚轮的方向
- 利用反射获得委托和事件以及创建委托实例和添加事件处理程序
- iPhone 如何使用UIImageView播放动画,并停留在之后一张图片并添加播放结束时的事件
- Android之屏幕方向改变以及onConfigurationChanged事件
- 【iOS奇葩特性】layoutSubviews在iPhone和iPad中,当设备方向改变后的调用情况
- C#动态生成控件以及添加事件处理
- iphone 如何设置在uiImageView上添加按钮,按钮透明并且能响应事件
- head first C#学习笔记:如何创建事件以及事件处理程序
- C#动态生成控件以及添加事件处理
- linux设备如何通过USB网络共享与手机通信(包含安卓手机以及iphone)
- 如何添加树的右键点击事件以及正确的节点点击事件(基于微软树)
- Mac 开发中如何设置 关闭 以及最小化 最大化按钮事件处理
- 利用反射获得委托和事件以及创建委托实例和添加事件处理程序
- 如何在abap中为ALV添加事件处理
- C#动态组件添加以及预定义事件处理
- android之屏幕方向改变以及onConfigurationChanged事件
- C#_动态生成控件以及添加事件处理
- 如何添加CMFCPropertyGridCtrl的属性改变响应事件 ?