小编Luk*_*ger的帖子

UIWebView不在iOS8上播放HTML5视频

我正试图UIWebView在iOS 8 的网站上播放HTML5视频.

该网站的网址是http://m.bild.de/video/clip/fifa-ballon-d-or/aufsager-ballon-dor-abend-39313060,variante=L,wantedContextId=39305342.bildMobile.html

视频的html代码如下所示:

<video controls="" preload="auto" src="http://videos-world.ak.token.bild.de/BILD/39/31/30/60/39313060,property=Video.mp4" poster="http://bilder.bild.de/fotos-skaliert/stand-aufsager-ballon-dor-abend-39313026/3,w=788,c=0.bild.jpg" style="width: 100%; height: 100%;"></video>
Run Code Online (Sandbox Code Playgroud)

上面的代码将异步加载并通过javascript放置.我无法修改此HTML代码.

一旦文章加载,我就可以看到视频顶部的播放按钮.当我点击它时,按钮会突出显示但没有任何反应.

在iOS 7上它可以工作.在iOS 8上没有.当我在Safari中打开文章时,视频在iOS 7和8上播放正常.

我还为UIWebView添加了这两行,但它仍然没有播放.

self.webView.allowsInlineMediaPlayback = YES;
self.webView.mediaPlaybackRequiresUserAction = NO;
Run Code Online (Sandbox Code Playgroud)

video html5 uiwebview ios ios8

2
推荐指数
1
解决办法
7421
查看次数

"EnumeratedSequence <[CGPoint]>"类型的值没有成员"compactMap"

我想在我的项目中实现Charts,但是当我打开demo项目时我得到了这个错误类型'EnumeratedSequence <[CGPoint]>'的值没有成员'compactMap'我看到这个类型'CGPoint'的值没有成员'makeWithDictionaryRepresentation '在swift 3链接但错误未解决.

ios swift

2
推荐指数
1
解决办法
1436
查看次数

如何判断NSPanel何时获得焦点或成为关键?

我正在XCode4中编写一个Cocoa/Objective-C应用程序,我需要知道我的首选项面板何时打开.我需要一些像windowDidBecomeKey这样的回调 ; 我试图按照提供的解决方案这个问题,但也windowDidBecomeKey还是windowDidExpose表现为委托方法(但其他人一样windowDidLoad,windowWillLoad等做的).

为了明确我的意思,"不要作为委托方法出现",我的意思是当我开始输入方法名称时,它们不会显示在自动完成中.无论如何我确实尝试过定义它们,但它们从未被调用过.

NSPanel对象缺乏这些方法,或有更多的东西我有什么关系?

目前,我有一个界面PrefWindowController:

PrefWindowController.h:

#import <Cocoa/Cocoa.h>

@interface PrefWindowController : NSWindowController
    //Delegate methods like windowDidBecomeKey appear to not be available here
@end
Run Code Online (Sandbox Code Playgroud)

PrefWindowController.m:

@implementation PrefWindowController

- (id)initWithWindow:(NSWindow *)window
{
    self = [super initWithWindow:window];
    if (self) {
        NSAlert *alert = [[[NSAlert alloc] init] autorelease];
        [alert setMessageText:@".."];
        [alert runModal];
    }

    return self;
}

- (void)windowDidLoad
{
    NSAlert *alert = …
Run Code Online (Sandbox Code Playgroud)

cocoa objective-c nswindowcontroller xcode4 nspanel

1
推荐指数
1
解决办法
1922
查看次数

如何在iOS中全局更改字体大小

我正在尝试编写扩展,以更改UIControl组件字体大小

extension UIViewController {

func changeFontSize(){
    for v in self.view.subviews{
        var fontSize = CGFloat(10)
        if let V = v as? UIButton       {V.titleLabel?.font = V.titleLabel?.font.withSize(fontSize)}
        if let V = v as? UILabel        {V.font = V.font.withSize(fontSize)}
        if let V = v as? UITextField    {V.font = V.font?.withSize(fontSize)}
    }
}
Run Code Online (Sandbox Code Playgroud)

我的问题是一些组件,如UITableView,如何访问单元格元素,以及UITableView节头组件,以便我使扩展也更改所有类型文本字体的所有子视图?

ios swift

1
推荐指数
1
解决办法
518
查看次数

使用 css 居中 sweetalert 文本

我试图将文本放在我的 swal-box 中,但它不起作用:

CSS3:

.swal-modal {
    text-align: center;
}
Run Code Online (Sandbox Code Playgroud)

JavaScript:

swal("myTitle", "some text \n some more text \n even more text);
Run Code Online (Sandbox Code Playgroud)

javascript css sweetalert

1
推荐指数
1
解决办法
2万
查看次数

UITapGestureRecognizer静态方法崩溃

我有一个带有多个custom UICollectionViewCell的快捷应用程序。所有细胞都有多个对象(无论是UIImageViewUILabel),用户可以点击(因此,我使用多个UITapGestureRecognizers到调用相应的行动。现在,为了减轻我的工作,使代码少重复,我想创造一个extensionUITapGestureRecognizerstatic我可以直接在类上调用的方法。

我确实做到了,但是应用程序崩溃的事实意味着有些事情我做得不好。这是我的代码:

extension UITapGestureRecognizer {
    static func addNewTapGuestureRecognizer(for imageView: UIImageView, selectorName: Selector) {
        let tap = UITapGestureRecognizer(target: self, action: selectorName)
        imageView.addGestureRecognizer(tap)
        imageView.isUserInteractionEnabled = true
    }

    static func addNewTapGuestureRecognizer(for label: UILabel, selectorName: Selector) {
        let tap = UITapGestureRecognizer(target: self, action: selectorName)
        label.addGestureRecognizer(tap)
        label.isUserInteractionEnabled = true
    }
}

class TextCVC: UICollectionViewCell {

    override func awakeFromNib() {
        super.awakeFromNib()
        addTapGuesturesForImagesAndLabels()
    }

    func addTapGuesturesForImagesAndLabels() {
        UITapGestureRecognizer.addNewTapGuestureRecognizer(for: postActionShareImageVIew, selectorName: #selector(self.shareImageTapped))
        UITapGestureRecognizer.addNewTapGuestureRecognizer(for: postActionLikeImageVIew, …
Run Code Online (Sandbox Code Playgroud)

ios uitapgesturerecognizer uicollectionviewcell swift

0
推荐指数
1
解决办法
85
查看次数

PHP foreach循环警告非法字符串偏移量

我有一个简单的循环问题.我有这样的数据:

$PRODUCT = [

'title' => 'Blouse',
'lines' => [

    'variants' => [
        [
            'price' => 112.34,
            'options' => [
                'size' => 'small',
                'color' => 'yellow',

            ]
        ],
        [
            'price' => 156.33,
            'options' => [
                'size' => 'small',
                'color' => 'blue',

            ]
        ],
    ],
  ]
Run Code Online (Sandbox Code Playgroud)

我需要创建一个这样的新表:

$options => [
        'size',
        'color'
    ]
Run Code Online (Sandbox Code Playgroud)

我试图'options'在循环中只使用带键的数组,我甚至有我需要的数据,但我有警告:

Warning: Illegal string offset 'options'
Run Code Online (Sandbox Code Playgroud)

我的循环看起来像这样:

$options = [];

foreach ($PRODUCT['lines'] as $variant){
    foreach ($variant as $item) {
      $options[] = $item['options'];
    }
 }
Run Code Online (Sandbox Code Playgroud)

我的错误在哪里?我知道这'price' …

php arrays foreach

0
推荐指数
1
解决办法
126
查看次数

如何在 SwiftUI 中添加弹出菜单视图?

我正在尝试在我的应用程序中实现一个类似于苹果天气应用程序的功能。这是一个照片示例:

在此输入图像描述

从外观上看,它是一个按钮,当用户单击它时,会出现其他内容。那是什么样的 SwiftUI 控件?基本上,什么代码制作了该按钮以及由此出现的小(迷你)菜单?

xcode ios swiftui

-1
推荐指数
2
解决办法
6157
查看次数