我正在构建一个包含WkWebView的弹出模式视图的应用程序.当我想在此模态视图中上传图像并且出现"照片选择"时,模态视图只会将其解除回发射它的视图控制器.
我怎么能防止这种情况?
import UIKit
class PostWindow : UIViewController {
@IBAction func close(sender: AnyObject) {
dismissViewControllerAnimated(true, completion: nil)
}
override func viewDidLoad() {
super.viewDidLoad()
// do stuff here
let myWebView:UIWebView = UIWebView(frame: CGRectMake(0, 70, UIScreen.mainScreen().bounds.width, UIScreen.mainScreen().bounds.height))
myWebView.loadRequest(NSURLRequest(URL: NSURL(string: "https://m.facebook.com/")!))
self.view.addSubview(myWebView)
self.title = "News Feed"
UIApplication.sharedApplication().setStatusBarStyle(UIStatusBarStyle.Default, animated: true)
UIApplication.sharedApplication().statusBarHidden = false
/*let addButton: UIBarButtonItem = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.Search,
target: self,
action: #selector(self.openSearch(_:)))
self.navigationItem.setRightBarButtonItems([addButton], animated: true)*/
self.navigationController?.navigationBar.tintColor = UIColor.blackColor()
}
override func preferredStatusBarStyle() -> UIStatusBarStyle {
return UIStatusBarStyle.LightContent
}
Run Code Online (Sandbox Code Playgroud)
}
谢谢!
我目前正在尝试实现类似于“格子”中的SearchView动画,但是遇到一个问题,因为在我的情况下,该应用程序应保持相同的活动,因此我需要使用ObjectAnimator将搜索图标移到后退图标。Animated Vector Drawable工作正常。
我确实尝试了到目前为止实现移动的方法:首先,我将Animated Vector Drawable放在MenuItem内。如果我告诉ObjectAnimator将该项目移到左侧,则动画开始后它将被隐藏(可能在某些工具栏元素的后面)。由于无法解决此问题,我决定尝试将ImageButton放在带有FrameLayout的工具栏上方,并告诉该ImageButton移至右侧,同时启动AVD动画,该方法可以正常工作。现在的问题是,如果我尝试让MenuItems X和Y将ImageButton放在MenuItem上方,我的应用程序将崩溃,并显示NullPointerException,指出找不到X和Y。
您看到我的问题的解决方案了吗?我要实现的动画是,搜索可绘制对象移至汉堡包图标(当打开搜索视图时,当按下“搜索”按钮时,它会显示一个搜索图标)。
我目前正在编写一个搜索引擎应用程序,并希望该应用程序在我进入应用程序时收听热门词汇,例如带有"Ok Google"的Google.我怎样才能让应用程序听到它,我怎样才能让它启动某个功能呢?
确切地说,这个功能:
btnSpeak.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(
RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, "de-DE");
try {
startActivityForResult(intent, RESULT_SPEECH);
txtText.setText("");
} catch (ActivityNotFoundException a) {
Toast t = Toast.makeText(getApplicationContext(),
"Ihr Gerät unterstützt kein Sprache-Zu-Text-System!",
Toast.LENGTH_SHORT);
t.show();
}
}
});
Run Code Online (Sandbox Code Playgroud)
谢谢你的帮助!
我拥有一台可以隐藏导航栏的HTC One A9.在我的应用程序中,我需要获取导航栏的高度并设置与其对应的填充.这是我现在的问题:当我隐藏导航栏时,填充仍然被设置(即使Snapchat有这个问题).我的问题是:是否有其他代码可以使它工作?
public static int getNavBarHeight(Context context) {
int result = 0;
int resourceId = context.getResources().getIdentifier("navigation_bar_height", "dimen", "android");
if (resourceId > 0) {
result = context.getResources().getDimensionPixelSize(resourceId);
}
return result;
}
Run Code Online (Sandbox Code Playgroud)
谢谢你的帮助!
android ×3
animation ×1
detection ×1
modal-view ×1
navigation ×1
swift ×1
transition ×1
vector ×1