我试图像2014年的WWDC会议214那样制作一个popover.
所以我开始使用具有两个视图的IB构建我的应用程序,这两个视图通过"Present As Popover"segue连接,如下:
弹出视图包含一个填充其超级视图的文本视图,具有以下约束:

为了支持模态popover,可以使用以下代码:
func adaptivePresentationStyleForPresentationController(controller: UIPresentationController) -> UIModalPresentationStyle {
return .OverFullScreen
}
func presentationController(controller: UIPresentationController, viewControllerForAdaptivePresentationStyle style: UIModalPresentationStyle) -> UIViewController? {
let navigationController = UINavigationController(rootViewController: controller.presentedViewController)
controller.presentedViewController.navigationItem.setRightBarButtonItem(UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.Done, target: self, action: "done"), animated: true)
return navigationController
}
Run Code Online (Sandbox Code Playgroud)
这给了我以下结果:

然后我尝试添加具有模糊效果的UIVisualEffectView.起初我只是在显示的控制器视图中添加一个子视图,在检查了视图层次结构后,我意识到我的效果视图实际上是在我的文本视图之上,但是我的文本视图被正确放置了.所以我尝试了insertSubview:atIndex:这样的方法:
func presentationController(controller: UIPresentationController, viewControllerForAdaptivePresentationStyle style: UIModalPresentationStyle) -> UIViewController? {
let effectView = UIVisualEffectView(effect: UIBlurEffect(style: .Light)) as UIVisualEffectView
effectView.setTranslatesAutoresizingMaskIntoConstraints(false)
controller.presentedViewController.view.insertSubview(effectView, atIndex: 0)
let viewList : [String : UIView] = ["effectView" : effectView]
let navigationController = UINavigationController(rootViewController: controller.presentedViewController)
controller.presentedViewController.navigationItem.setRightBarButtonItem(UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.Done, …Run Code Online (Sandbox Code Playgroud) popover swift ios8 uivisualeffectview uipresentationcontroller
我有一个可编辑的UITextView,它加载了一个属性String.此属性String加载了应用程序设置的自定义属性.出于这个原因,我总是将这些自定义属性添加到typingAttributestextView.
每当我打字它按预期工作文本,所加入的文字具有自定义属性集,但每当我使用的预测建议更换一个字,整个单词的设置没有自定义属性.
据我所知,每次以编程方式设置属性文本时,都会typingAttributes自动清除.因此,当选择预测建议时,文本会以编程方式设置,因此我丢失了所有自定义属性.
有没有办法解决?
我有total_lines一个jython命令的变量,我需要在ODI变量的刷新命令上访问它.
with open('file.txt') as file_name:
for total_lines, line in enumerate(file_name):
pass
print total_lines
total_lines += 1
Run Code Online (Sandbox Code Playgroud)
为此我想到了使用<@@>将它传递给Java Beanshell变量.像这样:在jython命令中:
<@int totallines = total_lines; @>
Run Code Online (Sandbox Code Playgroud)
在刷新命令中:
select '<@=totallines@>' from dual;
Run Code Online (Sandbox Code Playgroud)
这可能吗?如何将jython变量归属为beanshell变量?我有什么选择?
干杯
我正在使用an UITextView来显示带有自定义属性的属性字符串.出于这个原因,我决定实现自己的NSTextStorage,每次处理后我都可以插入自定义属性.
每当我需要显示UITextView我用来设置它的文本时这样:
textView.attributedText = mutableText
但是,通过使用我的新功能NSTextStorage,似乎更新attributedText它对UITextView没有任何影响,它只显示它创建的占位符文本.
如何将attributedText属性连接UITextView到存储在NSTextStorage?的attributesString中?为了实现这一目标,我需要在两个对象上覆盖哪些方法?