我在UIPopoverController中使用UIImagePickerController,它与iOS6完美配合.使用iOS 7时,显示捕获图像的"预览"图像会旋转,但如果我拍照,则会正确保存.
这就是我选择的方式:
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
imagePicker.delegate = self;
imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
imagePicker.mediaTypes = [NSArray arrayWithObjects:
(NSString *) kUTTypeImage,
nil];
imagePicker.allowsEditing = NO;
Run Code Online (Sandbox Code Playgroud)
并将其添加到弹出控制器:
self.imagePickerPopOver = [[UIPopoverController alloc] initWithContentViewController:imagePicker];
[self.imagePickerPopOver presentPopoverFromRect:CGRectMake(aPosViewA.x, cameraButton_y, 100.0, 30.0) inView:self.detailViewController.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
Run Code Online (Sandbox Code Playgroud)
这些是UIScrollView上按钮位置的计算,以显示正确位置的弹出窗口:
presentPopoverFromRect:CGRectMake(aPosViewA.x, cameraButton_y, 100.0, 30.0)
Run Code Online (Sandbox Code Playgroud)
我不认为问题就在那里,因为我尝试了几种组合.
我还尝试在全屏模式下捕获图像,但应用程序只允许使用横向模式.如果以纵向模式拍摄图像并且取消模态视图,则应用程序也将保持纵向模式.如果模态视图被解除,我找不到阻止UIImagePickerController切换到纵向模式或强制应用程序回到横向模式的方法.
UPDATE
我从这里得到了答案,又向前迈进了一步.
我在创建选择器之后和显示弹出窗口之前转换视图:
switch ([UIApplication sharedApplication].statusBarOrientation) {
case UIInterfaceOrientationLandscapeLeft:
self.imagePicker.view.transform = CGAffineTransformMakeRotation(M_PI/2);
break;
case UIInterfaceOrientationLandscapeRight:
self.imagePicker.view.transform = CGAffineTransformMakeRotation(-M_PI/2);
break;
default:
break;
}
Run Code Online (Sandbox Code Playgroud)
只要我不转动iPad,它就能正常工作.为此,我正在注册方向更改事件:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(orientationChanged:) name:UIDeviceOrientationDidChangeNotification object:nil];
Run Code Online (Sandbox Code Playgroud)
并更改选择器视图:
- …Run Code Online (Sandbox Code Playgroud) uiimagepickercontroller uipopovercontroller uiinterfaceorientation ios ios7
我有一个iPad调查工具作为内部企业应用程序.我阻止锁屏与设置[[UIApplication sharedApplication] setIdleTimerDisabled: YES];在didFinishLaunchingWithOptions应用程序委托的.
这工作正常,直到我使用imagePicker拍摄图像.之后,idleTimer再次激活.我试图在拍摄图像后禁用它,但这不起作用.
在这里,我发现提示在info.plist中设置所需的设备功能可能会有所帮助.但到目前为止它没有.我刚刚添加了所有相机特定的标志.
有任何想法吗?
非常感谢!
马库斯
关于rails和bootstrap的另一个新手问题.
我使用的是这样的东西:
<div class="tabbable tabs-left">
<ul class="nav nav-tabs">
<li class="active"><a href="#tab1" data-toggle="tab">About us</a></li>
<li><a href="#tab9" data-toggle="tab">Address</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="tab1">
<%= render 'about_us' %>
</div>
<div class="tab-pane" id="tab9">
<%= render 'address' %>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
我的问题是我渲染包含表格的'地址'.通过提交此表单,我最终会使用不同的控制器.使用此控制器保存新地址后,我想重定向到此页面并显示地址选项卡.
我尝试的重定向命令是:redirect_to salon_path(@ salon.id.to_s +"#tab9")这导致调用url .../salons/1%23tab9.我认为我需要它.../salons/1#tab9.
但也许你有一个更好的解决方案如何选择一个特定的选项卡.
使用:
gem 'rails', '3.2.3'
gem 'bootstrap-sass', '2.0.3'.
Run Code Online (Sandbox Code Playgroud) 我们目前正在使用ckeditor在rails应用程序中获取富文本字段.这不是很好,例如,如果你粘贴一些文字,你永远不知道保存后会发生什么.我很想拥有像basecamp一样的文本区域.有任何想法或指示如何到达那里?