我是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个按钮(保持显示文本字段),它不会显示警告.任何解释为什么会这样?如何修复警告?
只是对https://medium.com感到好奇,我看到他们在搜索页面上发出了自动ajax GET请求,我打开了萤火虫(出于好奇),并得到如下结果:
(我输入了搜索词组sen以触发GET对https://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)'还不够吗?
我正在尝试使用 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) 我放置NSSearchField并设置其边框none,我发现清除按钮不可点击,点击时没有响应.如果我再次设置边框,它工作正常.
我已经调试了几个小时,并发现当我将边框设置为none时,文本编辑器宽度将展开并阴影(覆盖)清除按钮.
截图
查看层次结构调试截图
重现步骤:
NSSearchField 这是一个错误吗?或者它打算这样做?
注意:新手可可开发