这个可以,在objectC打开相册时,如果是横屏就横屏打开,如果是竖屏就竖屏打开
2015-02-13 00:00
197 查看
摘要: 可以在supportedInterfaceOrientations 控制方向
//添加图片
//-(IBAction)addPic:(id)sender
-(void)addPic:(UIButton *)sender
{
imagePicker = [[UIImagePickerController alloc] init];
imagePicker.delegate = self;
imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
imagePicker.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
imagePicker.allowsEditing = YES;
[self presentViewController:imagePicker animated:YES completion:^{}];
}
//-------------------------------------------------------
@interface UIImagePickerController (LandScapeImagePicker)
- (BOOL)shouldAutorotate;
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation ;
-(NSUInteger)supportedInterfaceOrientations ;
@end
@implementation UIImagePickerController (LandScapeImagePicker)
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight );
}
-(NSUInteger)supportedInterfaceOrientations {
if ([[UIDevice currentDevice] orientation]==UIInterfaceOrientationPortrait) {
return UIInterfaceOrientationMaskAllButUpsideDown;
}else if([[UIDevice currentDevice] orientation]==UIInterfaceOrientationLandscapeLeft || [[UIDevice currentDevice] orientation]==UIInterfaceOrientationLandscapeRight){
return UIInterfaceOrientationMaskLandscape;
}else{
return UIInterfaceOrientationMaskAllButUpsideDown;
}
}
- (BOOL)shouldAutorotate {
return NO;
}
@end
//------------------------------------------
另外,如果是ipad不是iphone 相册的选择取消可能是英文
1. UIImagePickerController页面的Cancel和Choose按钮以及截取中得重拍按钮,想改成中文
本来打算通过获取这些按钮的指针进行设置的,最后发现可以在工程中直接 project-->info-->Localization--->language中add一个简体中文就可以了
参考:http://www.cocoachina.com/bbs/read.php?tid=132828
//添加图片
//-(IBAction)addPic:(id)sender
-(void)addPic:(UIButton *)sender
{
imagePicker = [[UIImagePickerController alloc] init];
imagePicker.delegate = self;
imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
imagePicker.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
imagePicker.allowsEditing = YES;
[self presentViewController:imagePicker animated:YES completion:^{}];
}
//-------------------------------------------------------
@interface UIImagePickerController (LandScapeImagePicker)
- (BOOL)shouldAutorotate;
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation ;
-(NSUInteger)supportedInterfaceOrientations ;
@end
@implementation UIImagePickerController (LandScapeImagePicker)
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight );
}
-(NSUInteger)supportedInterfaceOrientations {
if ([[UIDevice currentDevice] orientation]==UIInterfaceOrientationPortrait) {
return UIInterfaceOrientationMaskAllButUpsideDown;
}else if([[UIDevice currentDevice] orientation]==UIInterfaceOrientationLandscapeLeft || [[UIDevice currentDevice] orientation]==UIInterfaceOrientationLandscapeRight){
return UIInterfaceOrientationMaskLandscape;
}else{
return UIInterfaceOrientationMaskAllButUpsideDown;
}
}
- (BOOL)shouldAutorotate {
return NO;
}
@end
//------------------------------------------
另外,如果是ipad不是iphone 相册的选择取消可能是英文
1. UIImagePickerController页面的Cancel和Choose按钮以及截取中得重拍按钮,想改成中文
本来打算通过获取这些按钮的指针进行设置的,最后发现可以在工程中直接 project-->info-->Localization--->language中add一个简体中文就可以了
参考:http://www.cocoachina.com/bbs/read.php?tid=132828
相关文章推荐
- cocos2dx ios中横屏切换竖屏相册崩溃
- 如果发现电脑只能上QQ但网页打不开可以参考这个
- windows.setparent可以将一个窗口显示到别的位置上,可是如果我只是想将这个窗口上的内容复制一份并显示在别的位置,该如何做呢?
- 开平方 如果没有计算器,我们如何求2的平方根? 可以先猜测一个数,比如1.5,然后用2除以这个数字。
- 如果对未来迷茫的时候,请打开这个锦 囊
- 求1-1000内所有的完数(一个数如果恰好等于它的因子之和,这个数就称为“完数”。如6就是1个完数: 6=1+2+3,因子数就是所有可以整除这个数的数,但是不包括这个数自身.比如15的
- 储存每一个单词W以及W的所有前缀,特定方的方向执行一次扫描的时候,如果被查找的单词作为前缀不在散列表中,那么在这个方向上可以及早终止
- 横屏游戏内打开应用内appstore界面出现竖屏的情况
- 求教 ,比如我想用panel 打开百度,如果不用iframe,那可以用什么?
- 如果你有多的钱 可以向这个帐号打 随便你打多少
- 当使用VS CODE 时,如果窗口中打开的文件无法识别HTML的话,可以使用以下方法添加要识别的文件类型
- IOS 横屏 打开相册 问题
- 老大要求把Word文档加上公司的标识,公司名文字或者logo图片都可以,但要求是用电脑打开(电子文档时)能看见标识,如果打印出来(纸质文档)就不显示出来,如何实现?
- AJAX POST 到特定链接,一直提示400错误,但是单独在浏览器里面又可以打开这个链接!
- 已知一个几乎有序的数组,几乎有序是指,如果把数组排好顺序的话,每个元素移动的距离可以不超过k,并且k相对于数组来说比较小。请选择一个合适的排序算法针对这个数据进行排序。 给定一个int数组A,同时给定
- 如果用asp4.0 只要将web,config中的这个带4.5删除就可以,对不对
- c# datagridview导出导入excel 如果用流的方式打开,可以导出,无法读取
- 局域网搜索-秒搜神器:everything 如果打造etp服务器,并且在本地可以双击打开
- Adapter 如果客户需要使用某个类的服务,而这项服务是这个类用一个不同的接口提供的,那么,可以使用适配器模式为客户提供一个期望的接口
- 横向图片轮播(如果一个项目里面只需用这一次,可以用这个插件,多次则不建议使用)