/**
// UIInterfaceOrientation ,屏幕方向
UIInterfaceOrientationUnknown = UIDeviceOrientationUnknown,
UIInterfaceOrientationPortrait = UIDeviceOrientationPortrait,
UIInterfaceOrientationPortraitUpsideDown = UIDeviceOrientationPortraitUpsideDown,
UIInterfaceOrientationLandscapeLeft = UIDeviceOrientationLandscapeRight,
UIInterfaceOrientationLandscapeRight = UIDeviceOrientationLandscapeLeft
*/
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
// 即将旋转执行动画
NSLog(@"%s", __func__);
}
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
// 即将旋转
NSLog(@"%s", __func__);
}
- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator
{
// 1.判断是否是横屏
BOOL isLandscape = size.width == 1024;
// 2.设置Dock的宽度和高度
// 获取屏幕旋转动画执行的时间
CGFloat duration = [coordinator transitionDuration];
[UIView animateWithDuration:duration animations:^{
}];
}
强调
UIPopoverController不是继承UIViewController,也就不具备显示功能,要设置内容,使用initWithContentViewController设置内容- (id)initWithContentViewController:(UIViewController *)viewController;
- (void)setContentViewController:(UIViewController *)viewController animated:(BOOL)animated;
@property (nonatomic, retain) UIViewController *contentViewController;
/**
* 弹出UIPopoverController的方法(一)
*
* @param item 围绕着哪个UIBarButtonItem显示
* @param arrowDirections 箭头的方向
* @param animated 是否通过动画显示出来
*/
- (void)presentPopoverFromBarButtonItem:(UIBarButtonItem *)item permittedArrowDirections:(UIPopoverArrowDirection)arrowDirections animated:(BOOL)animated;
/**
* 弹出UIPopoverController
*
* @param rect 指定箭头所指区域的矩形框范围(位置和尺寸)
* @param view rect参数是以view的左上角为坐标原点(0,0)
* @param arrowDirections 箭头的方向
* @param animated 是否通过动画显示出来
*/
- (void)presentPopoverFromRect:(CGRect)rect inView:(UIView *)view permittedArrowDirections:(UIPopoverArrowDirection)arrowDirections animated:(BOOL)animated;