CustomIOS7AlertView风景模式
问题描述:
我在创建一个CustomAlertview使用CustomIOS7AlertView,与文字和图像。因为我读了简单的AlertView是不可能设置最大高度,当我们添加图像时...CustomIOS7AlertView风景模式
我的问题是这样的:我创建CustomAlertView与图像,但我不能以任何方式,为IPAD(在横向上)以横向模式显示。它始终显示为垂直。
我试着旋转customAlertview,但我还没有成功...
谁能帮助我?
这是我的代码:
UIView * vista = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 500, 500)];
UIImageView *imgView;
if (([[UIDevice currentDevice].model rangeOfString:@"iPad"].location!=NSNotFound)) {
imgView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 400, 400)];
} else {
imgView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 300, 300)];
}
[imgView setImage:img];
[vista addSubview:imgView];
CustomIOS7AlertView *alertView = [[CustomIOS7AlertView alloc] init];
[alertView setContainerView:vista];
[alertView show];
谢谢!
答
将观察者放在CustomIOS7AlertView中进行方向更改,然后每次更改方向时都使视图正确定向。
参考:Detecting iOS UIDevice orientation了解更多关于方向更改通知。
答
解决!正如同事noir_eagle说,问题是在显示(CustomIOS7AlertView.m)方法,尤其是不得不修改下面一行,从而影响到旋转:
UIInterfaceOrientation interfaceOrientation = [[UIApplication sharedApplication] statusBarOrientation];
switch (interfaceOrientation) {
case UIInterfaceOrientationLandscapeLeft:
**self.transform = CGAffineTransformMakeRotation(M_PI * 360/180.0);**
谢谢版本了! ;)
很可能你的问题是'CustomIOS7AlertView'' show'方法的实现 –