标签:
/**
// 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__);
}
在iOS8以后,屏幕就只有屏幕之分,即当屏幕的宽大于高就是横屏,否则是竖屏。
- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator
{
// 1.判断是否是横屏
BOOL isLandscape = size.width == 1024;
// 2.设置Dock的宽度和高度
// 获取屏幕旋转动画执行的时间
CGFloat duration = [coordinator transitionDuration];
[UIView animateWithDuration:duration animations:^{
}];
}
UIModalPresentationPageSheet
UIModalPresentationCurrentContext :跟随父控制器的呈现样式
强调
UIPopoverController不是继承UIViewController,也就不具备显示功能,要设置内容,使用initWithContentViewController设置内容- (id)initWithContentViewController:(UIViewController *)viewController;
- (void)setContentViewController:(UIViewController *)viewController animated:(BOOL)animated;
@property (nonatomic, retain) UIViewController *contentViewController;
设置popView的大小(默认控制器有多大就显示多大)(120, 44 * 3)
内容控制器中设置的方法
/**
* 弹出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;
方法
[Popover dismissPopoverAnimated:YES]
标签:
原文地址:http://www.cnblogs.com/wcLT/p/4791027.html