小编sen*_*lim的帖子

显示UIAlertViewController时,XCODE iphone 6 plus和6s plus会显示警告

我是iOS开发的新手.我试图显示UIAlertController单击按钮的时间(故事板为空,故事板中只有1个按钮),使用下面的代码

@IBAction func showAlert(sender: UIBarButtonItem) {
  let alert = UIAlertController(
    title: "Create new",
    message: "Hi",
    preferredStyle: UIAlertControllerStyle.Alert
  )

  let createAction = UIAlertAction(title: "Ok", style: .Default, handler: nil)
  let cancelAction = UIAlertAction(title: "Cancel", style: .Cancel, handler: nil)

  alert.addAction(createAction)
  alert.addAction(cancelAction)
  alert.addTextFieldWithConfigurationHandler {
    $0.placeholder = "Test placeholder"
  }

  presentViewController(alert, animated: true, completion: nil)
}
Run Code Online (Sandbox Code Playgroud)

iphone 5,5s,6,6s不显示警告,但iphone 6plus和6s plus显示警告

2015-10-20 22:38:54.007 TestApp [3128:48601]未定义UICollectionViewFlowLayout的行为,因为:2015-10-20 22:38:54.008 TestApp [3128:48601]项目高度必须小于UICollectionView的高度减去该部分的顶部和底部值,减去内容插入的顶部和底部值.2015-10-20 22:38:54.008 TestApp [3128:48601]相关的UICollectionViewFlowLayout实例是<_UIAlertControllerCollectionViewFlowLayout:0x7fd6b8582d90>,它附加到; layer =; contentOffset:{0,0}; contentSize:{0,0}>集合视图布局:<_ UIAlertControllerCollectionViewFlowLayout:0x7fd6b8582d90>.

如果我删除文本字段UIAlertController或删除2个按钮(保持显示文本字段),它不会显示警告.任何解释为什么会这样?如何修复警告?

iphone ios swift uialertcontroller

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

为什么中号的API在while(1)之前加到JSONP响应中?

只是对https://medium.com感到好奇,我看到他们在搜索页面上发出了自动ajax GET请求,我打开了萤火虫(出于好奇),并得到如下结果:

(我输入了搜索词组sen以触​​发GEThttps://medium.com/search/all?q=sen的请求。请注意,如果您打开它,则它仅会收到ajax请求,因此无法正常工作)

])}while(1);</x>{"success":true,"payload":{"value":{"posts":[{"id":"748b78360917","versionId":"9fbac25a3c7c","creatorId":"29fed3d34b82","homeCollectionId":"e196dfdf4b5d","title":"Nous sommes des clients, pas des usagers. Et ça change tout" // MORE JSON RESPONSE FROM SERVER....

现在的问题不在于JSON零件,我想知道])}while(1);</x>响应中的含义是什么?目的是什么?

更新, 我知道这while(1)是无限循环的,但是为什么要这样做呢?

更新 我读了类似的问题,现在我知道使用'while(1)'是为了防止json劫持,但是''])} while(1);' 部分仍然令人困惑,为什么要使用'])}'和''?'while(1)'还不够吗?

javascript api rest json get

5
推荐指数
0
解决办法
183
查看次数

NodeJS 3DES ECB 加密不等于 C# 加密

我正在尝试使用 3DES ECB 将 C# 代码转换为加密文本(您可以将其复制并粘贴到https://dotnetfiddle.net/上来运行它)

using System;
using System.Configuration;
using System.Security.Cryptography;
using System.Text;

public class Program
{
    public static void Main()
    {
        string toEncrypt = "testtext";
        string key = "testkey";
        bool useHashing = true;
        byte[] keyArray;
        byte[] toEncryptArray = UTF8Encoding.UTF8.GetBytes(toEncrypt);

        System.Configuration.AppSettingsReader settingsReader =
                                                new AppSettingsReader();

        key = string.IsNullOrEmpty(key) ? (string)settingsReader.GetValue("SecurityKey", typeof(String)) : key;

        if (useHashing)
        {
            MD5CryptoServiceProvider hashmd5 = new MD5CryptoServiceProvider();
            keyArray = hashmd5.ComputeHash(UTF8Encoding.UTF8.GetBytes(key));

            hashmd5.Clear();
        }
        else 
        {
            keyArray = UTF8Encoding.UTF8.GetBytes(key);
        }

        TripleDESCryptoServiceProvider tdes = new TripleDESCryptoServiceProvider(); …
Run Code Online (Sandbox Code Playgroud)

c# encryption 3des ecb node.js

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

OSX Cocoa NSSearchField清除按钮没有响应点击

我放置NSSearchField并设置其边框none,我发现清除按钮不可点击,点击时没有响应.如果我再次设置边框,它工作正常.

在此输入图像描述

我已经调试了几个小时,并发现当我将边框设置为none时,文本编辑器宽度将展开并阴影(覆盖)清除按钮.

截图

在此输入图像描述

查看层次结构调试截图

在此输入图像描述

重现步骤:

  1. 创建一个空的可可项目/应用程序
  2. 放置一个 NSSearchField
  3. 将边框设置为无
  4. 运行应用程序,填写搜索字段并尝试单击清除按钮

这是一个错误吗?或者它打算这样做?

注意:新手可可开发

cocoa nsview nssearchfield swift

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

标签 统计

swift ×2

3des ×1

api ×1

c# ×1

cocoa ×1

ecb ×1

encryption ×1

get ×1

ios ×1

iphone ×1

javascript ×1

json ×1

node.js ×1

nssearchfield ×1

nsview ×1

rest ×1

uialertcontroller ×1