我试图避免在横向上进行全屏键盘编辑以访问建议.
我已经阅读了很多线程,解释说我必须添加像FlagNoFullscreen和/或flagNoExtractUi这样的EditorInfo标志.
我以编程方式添加了它们但没有真正帮助.
有没有办法解决这个问题?
当我呈现仅支持横向的SecondViewController时,第一个UIViewController中的安全区域插入会更改为安全区域插图.
FirstViewController:
class ViewController: UIViewController {
@IBAction func showSecondVC(_ sender: Any) {
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let controller = storyboard.instantiateViewController(withIdentifier: "SecondViewController")
self.present(controller, animated: true, completion: {
print("completed")
})
}
override func viewSafeAreaInsetsDidChange() {
print(view.safeAreaInsets)
super.viewSafeAreaInsetsDidChange()
print(view.safeAreaInsets)
}
}
Run Code Online (Sandbox Code Playgroud)
第二个ViewController:
class SecondViewController: UIViewController {
override var supportedInterfaceOrientations: UIInterfaceOrientationMask {
return [.landscape]
}
@IBAction func dismissYourSelff(_ sender: Any) {
self.dismiss(animated: true, completion: nil)
}
}
Run Code Online (Sandbox Code Playgroud)
控制台输出:
UIEdgeInsets(top: 44.0, left: 0.0, bottom: 34.0, right: 0.0)
UIEdgeInsets(top: 44.0, left: …
Run Code Online (Sandbox Code Playgroud) 我试图在离散能量景观中找到两个最大值之间的最短路径,其中最短路径是在总路径的过程中减小最小高度的路径.可能最大的能量路径是更正确的术语,但换句话说,即使路径在景观周围长距离行进但不会进入山谷,它也会被认为是好的.
我最初的想法是创建一个景观图,其中权重是邻居之间景观高度的差异,分别是上升和下降的负面积极.我刚刚意识到这不会给出我需要的结果,实际上局部最大值之间的所有路径都将具有完全相同的成本.
然后我意识到如果该图上节点之间的距离取决于当前位置和路径的历史,那么我可以得到我需要的结果.例如,如果路径从一个山谷向下和向上,那么我将不会分配额外的费用去往另一个山谷(只要路径不超过它以前没有到过的低点).
那么是否存在图搜索算法,其中距离可以随着路径的探索而动态变化?
还是有任何其他建议来攻击这个问题?
在我的相机应用程序中,您可以在前后相机之间切换.当我用后置摄像头拍照时,图像与预览显示相同.但是当我切换到前置摄像头时,图像就是镜像.我认为前后摄像头处于横向模式是有目共作的.我已经尝试了几乎所有给出的答案.
如果有人能指出我正确的方向,那真的会有所帮助.
我最近几天一直在使用ActionBar和ActionBarSherlock,在ActionBar中填写一些信息时遇到了一些问题.
当应用程序以纵向模式运行时,ActionBar看起来很好,并且可以显示所有数据,例如:
但当我将应用程序切换为横向显示时,会裁剪一些数据:
您可以注意到由于ActionBar的新高度,状态图标和电子邮件的裁剪方式.
在这种情况下,我想保持相同的纵向和横向大小,以便应用程序看起来很好.我无法减小操作栏标题的字体大小,因为它可能包含其他图标.
我将这些图标放在操作栏标题和副标题中的方式是使用Html.fromHtml
有什么想法可以解决这个问题?我正在使用ActionBarSherlock库!
android landscape portrait actionbarsherlock android-actionbar
我正在实施StoreKit应用内应用程序购买界面,虽然看起来SKStoreProductViewController
iPad上的手柄风景,但我的iPhone上的应用程序似乎没有这样做(它是通用的).
界面SKStoreProductViewController
是如此有限,我似乎无法以VC
任何方式操纵. 有没有其他人遇到这个?任何解决方法?
当我运行在iPad上运行的代码时,SKStoreProductViewController
它从左侧进入,大约一英寸,并在那里挂起直到被解雇.它看起来很实用,但它会让解雇时出现的VC混乱.
这是代码:
// Set up the store vc (creating it if not already done)
if (self.storeVC == nil) self.storeVC = [[SKStoreProductViewController alloc] init];
self.storeVC.delegate = self;
NSDictionary *params = [NSDictionary dictionaryWithObject:appID forKey:SKStoreProductParameterITunesItemIdentifier];
// Set up a HUD in case connecting to the store takes a while
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
[self.storeVC loadProductWithParameters:params
completionBlock:^(BOOL result, NSError *error) {
[MBProgressHUD hideHUDForView:self.view animated:YES];
if (result) {
[self presentViewController:self.storeVC animated:NO completion:^{
}];
}
}]; …
Run Code Online (Sandbox Code Playgroud) 我应该输入config.xml
什么或者我应该做些什么,让AndroidG设备上的PhoneGap Build应用程序的启动屏幕在横向模式下正确显示?
PhoneGap Build(用于编译)docs/blog对此一无所知.只有Portrait适用于Android.
由于first(docs)说使用height
并且width
支持跨平台,我尝试使用它:
<gap:splash src="res/splash-200x320-android.png" gap:platform="android" gap:density="ldpi" width="200" height="320" />
<gap:splash src="res/splash-320x480-android-bada-ios.png" gap:platform="android" gap:density="mdpi" width="320" height="480" />
<gap:splash src="res/splash-480x800-android-bada-wp.png" gap:platform="android" gap:density="hdpi" width="480" height="800" />
<gap:splash src="res/splash-720x1280-android.png" gap:platform="android" gap:density="xhdpi" width="720" height="1280" />
<gap:splash src="res/splash-320x200-android.png" gap:platform="android" gap:density="ldpi" width="320" height="200" />
<gap:splash src="res/splash-480x320-android-bada-ios.png" gap:platform="android" gap:density="mdpi" width="480" height="320" />
<gap:splash src="res/splash-800x480-android-bada-wp.png" gap:platform="android" gap:density="hdpi" width="800" height="480" />
<gap:splash src="res/splash-1280x720-android.png" gap:platform="android" gap:density="xhdpi" width="1280" height="720" />
Run Code Online (Sandbox Code Playgroud)
但是没有效果 - 在我的Android设备上的横向模式中,我总是看到我的启动画面的strechead portait模式版本.
我试图按照方法强制观察我的观点:
- (NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskLandscape;
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
return UIInterfaceOrientationLandscapeLeft;
}
- (BOOL)shouldAutorotate{
return YES;
}
Run Code Online (Sandbox Code Playgroud)
两者都没有奏效.请注意,我正在模拟器和iPad上进行测试.
谢谢
我有一个ViewController管理一个视图,其中我有一个表视图,一个ImageView和一个导航栏.当我把它放在横向模式时导航栏没有调整到32,它仍然保持到44我首先尝试在IB中使用自动调整但没有成功,然后我尝试将此代码放在ViewController中
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)orientation duration:(NSTimeInterval)duration {
//[super willAnimateRotationToInterfaceOrientation:orientation duration:duration];
CGRect frame = self.navigationController.navigationBar.frame;
if (UIInterfaceOrientationIsPortrait(orientation)) {
frame.size.height = 44;
} else {
frame.size.height = 32;
}
self.navigationController.navigationBar.frame = frame;
}
Run Code Online (Sandbox Code Playgroud)
但没什么.我该如何解决这个问题?
我的应用程序只是一个修改过的ImageViewer,可以选择缩放和拖动.包含修改后的Imageviewer有一个RelativeLayout(我想用作AbsoluteLayout).
然后,可以将新元素添加到布局中以将它们置于图像的某些点中.元素的位置(x,y)以像素为单位,因此我想没有其他方式可以通过编程方式添加它们,而不是使用XML.
然后,每次执行拖动或缩放操作时,都会更新这些元素的位置.
问题是,不知何故,图像的像素与RelativeLayout中的像素不匹配!因此项目"或多或少"位于但不在适当的位置(距离(0,0)越远,误差越大).
我已经尝试过的事情:
尝试不同的转换,因为问题可能与位图和布局之间的密度差异有关:
Resources r = getResources();
float x = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 100, r.getDisplayMetrics());
Run Code Online (Sandbox Code Playgroud)尝试在布局中使用不同的方法来设置边距:
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
params.leftMargin = (int) newPosition.x;
params.topMargin = (int) newPosition.y;
element.setLayoutParams(params);
Run Code Online (Sandbox Code Playgroud)我也想在XML中使用RelativeLayout的可用选项,但我真的无法以编程方式找到它,但我可以找到指定维度的方法,我的意思是:
android:layout_marginLeft ="50px" // or "50mm", or dp, or inches...
Run Code Online (Sandbox Code Playgroud)