小编JAL*_*JAL的帖子

表单之外的按钮html标签是否有效?

我只注意到,在的SoundCloud,跑道上的"动作"按钮(如,转贴等)都是HTML按钮标签.此外,它们既不在形式内,也不与形式相关联,也不提交表格(它们显然是通过javascript处理的).这是有效的HTML吗?没有表格的按钮是否可以存在?或者这只是使这些按钮成为可点击的div?屏幕阅读器的有效/无效程度如何?

html forms html5 button

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

用户拒绝推送通知提示时的回调方法?

我的问题是我想显示初始推送通知提示的加载屏幕"应用程序想要向您发送推送通知".

因此,如果用户点击,yes我可以继续并在随后调用的委托方法中启动应用程序:

- (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken
{
  [self hideLoadingScreen];
}

- (void)application:(UIApplication*)application didFailToRegisterForRemoteNotificationsWithError:(NSError*)error
{
  [self hideLoadingScreen];
}
Run Code Online (Sandbox Code Playgroud)

但是,如果用户点击no,则不会调用这些方法,这是有道理的.我的问题是,是否有一个不同的委托方法,如果他拒绝,会被解雇?

我的问题是如果no被选中,加载屏幕永远不会消失.所以我不知何故需要知道用户何时完成选择.

objective-c push-notification apple-push-notifications ios

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

更改表而不锁定整个表

是否

ALTER TABLE sample ADD COLUMN `hasItem` tinyint(1) DEFAULT NULL
Run Code Online (Sandbox Code Playgroud)

锁定整个桌子?

mysql

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

你如何使用youtube-dl下载直播(现场直播)?

只是想知道是否可能 - 当我将视频网址复制到YouTube-dl时,它会吐出来

[https @ 0x7fc351416080] inflate return value: -3, incorrect header check
Last message repeated 15 times
Run Code Online (Sandbox Code Playgroud)

在那之后,它吐出了几行似乎不想正确复制的红色文本,所以我拿了一个片段

图片

有谁知道这是否可能?

youtube youtube-dl youtube-livestreaming-api

33
推荐指数
3
解决办法
7万
查看次数

iOS 10中的UIVisualEffectView

我提出了一个包含UIVisualEffectView的UIViewController,如下所示:

-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
    [self performSegueWithIdentifier:@"segueBlur" sender:nil];
}

-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    if([segue.identifier isEqualToString:@"segueBlur"]) {
        ((UIViewController *)segue.destinationViewController).providesPresentationContextTransitionStyle = YES;
        ((UIViewController *)segue.destinationViewController).definesPresentationContext = YES;
        ((UIViewController *)segue.destinationViewController).modalPresentationStyle = UIModalPresentationOverFullScreen;
    }
}
Run Code Online (Sandbox Code Playgroud)

正如您所看到的,我正在使用UIModalPresentationStyleOverFullScreen,以便当出现模糊的视图控制器时,模糊将"应用"到呈现它的视图控制器的内容; segue具有Cross Dissolve过渡风格.

效果看起来像预期的那样.但是,在iOS 9中,演示比iOS 10更流畅.在iOS 10中,当视图控制器出现时,它看起来像是两步动画,而在iOS 9中,模糊立即应用.

一张图片胜过千言万语所以我上传了一段显示这种奇怪行为的视频:

UIVisualEffectView iOS 9 vs iOS 10

我的问题是:如何在iOS 10中呈现iOS 10中的视图控制器?

objective-c ios uivisualeffectview ios10 xcode8

31
推荐指数
2
解决办法
4233
查看次数

如何使用JavaScript创建秒表?

if(stopwatch >= track[song].duration)
Run Code Online (Sandbox Code Playgroud)

track[song].duration 找到soundcloud轨道的持续时间.

我期待创建一个秒表功能,当你点击swapID 时开始计算毫秒数,stopwatch这样当函数被"点击"一段时间后,if函数会做一些事情.在我的情况下,替换图像.此外,当再次单击时,该功能将自行重置.

所以喜欢stopwatch= current time- clicked time如何设置clicked time

current time= new Date().getTime();?这是几毫秒?

$('#swap').click(function()...
Run Code Online (Sandbox Code Playgroud)

javascript jquery

30
推荐指数
3
解决办法
8万
查看次数

在Xcode 8和iOS 10中使用NSUserDefaults

NSUserDefaults 不再是iOS 10 SDK中的类:

let defaults = NSUserDefaults.standardUserDefaults()
Run Code Online (Sandbox Code Playgroud)

这无法编译.这个班级被删除了吗?

(这是一个规范的问答对,以防止重复的问题泛滥)

ios swift swift3 ios10 xcode8

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

嵌入YouTube视频

我通过互联网上找到的代码片段从YouTube嵌入了一段视频,这是我用过的代码:

    @interface FirstViewController (Private)
- (void)embedYouTube:(NSString *)urlString frame:(CGRect)frame;
@end


@implementation FirstViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    [self embedYouTube:@"http://www.youtube.com/watch?v=l3Iwh5hqbyE" frame:CGRectMake(20, 20, 100, 100)];
}


- (void)embedYouTube:(NSString *)urlString frame:(CGRect)frame {
    NSString *embedHTML = @"\
    <html><head>\
    <style type=\"text/css\">\
    body {\
    background-color: transparent;\
    color: white;\
    }\
    </style>\
    </head><body style=\"margin:0\">\
    <embed id=\"yt\" src=\"%@\" type=\"application/x-shockwave-flash\" \
    width=\"%0.0f\" height=\"%0.0f\"></embed>\
    </body></html>";
    NSString *html = [NSString stringWithFormat:embedHTML, urlString, frame.size.width, frame.size.height];
    UIWebView *videoView = [[UIWebView alloc] initWithFrame:frame];
    [videoView loadHTMLString:html baseURL:nil];
    [self.view addSubview:videoView];
    [videoView release];
}


- (void)didReceiveMemoryWarning {
    // Releases …
Run Code Online (Sandbox Code Playgroud)

youtube iphone objective-c ios

28
推荐指数
3
解决办法
3万
查看次数

以编程方式打开UITableView编辑操作按钮

我有一个UIPageViewController具有UITableViewControllers里面,并向左滑动手势之间冲突UIPageViewController的意见和之间改变UITableViewCells姿势,打开编辑的动作,所以我需要显示的编辑操作时,单击该单元中的某个按钮.

我的问题是,我可以以编程方式显示编辑操作按钮,而不是在滑动手势上显示它们吗?

uitableview ios swift

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

警告:UICollectionViewFlowLayout缓存了索引路径'abc'的帧不匹配

这是导致警告的代码:

private override func layoutAttributesForItemAtIndexPath(indexPath: NSIndexPath) -> UICollectionViewLayoutAttributes? {
    let attributes = super.layoutAttributesForItemAtIndexPath(indexPath)
    let distance = CGRectGetMidX(attributes!.frame) - self.midX;
    var transform = CATransform3DIdentity;
    transform = CATransform3DTranslate(transform, -distance, 0, -self.width);
    attributes!.transform3D = CATransform3DIdentity;
    return attributes
}
Run Code Online (Sandbox Code Playgroud)

控制台还打印:

这可能是因为流布局"xyz"正在修改UICollectionViewFlowLayout返回的属性而不复制它们.

我该如何修复此警告?

ios uicollectionview uicollectionviewlayout swift

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