我正在聊天.一切似乎都很好,但我遇到了一些'越野车'的问题.
我得到UIViewController与UITextView栏输入消息和UITableView.他们受到这种限制:"V:|-(64)-[chatTable][sendMessageBar]-(keyboard)-|".当键盘没有输出时 - 这个约束的常量是0.键盘输出后 - 我将常量增加到键盘高度.
当键盘没有出来时:
self.table.contentSize = (375.0,78.5)
self.table.bounds = (0.0,-490.0,375.0,568.5)
self.table.frame = (0.0,64.0,375.0,568.5)
self.table.subviews[0].frame (UITableViewWrapperView) = (0.0,0.0,375.0,568.5)
self.table.subviews[0].frame (UITableViewWrapperView) = (0.0,0.0,375.0,568.5)
Run Code Online (Sandbox Code Playgroud)
当键盘出现时:
self.table.contentSize = (375.0,78.5)
self.table.bounds = (0.0,-274.0,375.0,352.5
self.table.frame = (0.0,64.0,375.0,352.5)
self.table.subviews[0].frame (UITableViewWrapperView) = (0.0,-137.5,375.0,137.5)
self.table.subviews[0].frame (UITableViewWrapperView) = (0.0,0.0,375.0,137.5)
Run Code Online (Sandbox Code Playgroud)
因此,在我增加约束常量之后,UITableViewWrapperView的大小与它的superview - UITableView不同.有没有办法来解决这个问题 ?我认为UITableViewWrapperView会改变它的框架和界限,UITableView但事实并非如此.
任何想法在哪里是问题或我如何解决它?
并补充说:
一些研究之后-它似乎介于发生viewWillLayoutSubviews和viewDidLayoutSubviews.这有点奇怪:
override func viewWillLayoutSubviews() {
println("WrapperView Frame :991: \(self.table.subviews[0].frame)") \\ WrapperView Frame :991: (0.0,0.0,375.0,568.5)
super.viewWillLayoutSubviews()
println("WrapperView Frame :992: \(self.table.subviews[0].frame)") \\ …Run Code Online (Sandbox Code Playgroud) 我对两个AWS :: EC2 :: Instance属性感到困惑:
BlockDeviceMappings和Volumes.
我已多次阅读文档,但仍然没有真正理解其中的差异.
这是我的模板:
{
"AWSTemplateFormatVersion" : "2010-09-09",
"Description" : "kappoowTest",
"Mappings" : {
"AmazonLinuxAMI" : {
"eu-west-1" :
{ "AMI" : "ami-d8f9f1ac" },
"us-west-1" :
{ "AMI" : "ami-b63210f3" }
}
},
"Resources" : {
"SomeInstance" :{
"Type" : "AWS::EC2::Instance",
"Properties" : {
"AvailabilityZone" : "eu-west-1a",
"BlockDeviceMappings" : [
{
"DeviceName" : "/dev/sdc",
"Ebs" : { "VolumeSize" : "50" }
},
{
"DeviceName" : "/dev/sdd",
"Ebs" : { "VolumeSize" : "100" } …Run Code Online (Sandbox Code Playgroud) 我在代码中编写接口布局.因为每次我逐个像素地测试字体大小或视图布局时重新加载应用程序很烦人,所以我开始在操场上进行.这确实有很大帮助.但我确实想念那里的自定义字体.
有没有办法在游乐场添加自定义字体?
把这个问题写成我的最后一招,现在被困在这几天了.我想实现自我上浆细胞UICollectionView用FlowLayout.一切似乎工作正常,直到我reladData()或insertItemsAtIndexPaths()在集合底部看到.
这是我的手机:
class FooFoo: UICollectionViewCell {
var label: UILabel!
var text: String! {
didSet {
label.text = text
}
}
override init(frame: CGRect) {
super.init(frame: frame)
setupView()
setupConstraints()
}
required init(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func setupView() {
self.contentView.backgroundColor = UIColor.yellowColor()
label = ({
let view = UILabel()
view.setTranslatesAutoresizingMaskIntoConstraints(false)
self.contentView.addSubview(view)
return view
})()
}
func setupConstraints() {
self.contentView.addConstraints(NSLayoutConstraint.constraintsWithVisualFormat("H:|-100-[childView]-100-|", options: nil, metrics: nil, views: ["childView": label]))
self.contentView.addConstraints(NSLayoutConstraint.constraintsWithVisualFormat("V:|-100-[childView]-100-|", options: …Run Code Online (Sandbox Code Playgroud) flowlayout collectionview uicollectionview uicollectionviewlayout swift
所以我必须从 pip 为生产服务器安装大量需求。大多数这些要求需要 python-dev 和 build-essential 来编译。
现在我看待它的方式 - python-dev 和 build-essential 带来了一些开销,人们可能会争辩说,一些安全问题。
为了节省生产环境的性能,我的想法是为这些需求制作二进制包。
我发现大多数 pip 安装都带有installed-files.txt文件,列出了所有已安装的文件。因此,将所有列出的文件打包到某个二进制包中是很容易的。
现在我的问题 - 值得吗?有没有更简单的方法来解决它?此外,也许有人已经尝试过并在github. 如何创建一些虚拟环境 - 安装所有依赖项并为所有依赖项制作单个大型二进制包?
我试图在我的面料上安装面料CentOS 6.2.
克隆面料GitHub,通过它安装setup.py install
现在面料本身有效,但当我尝试使用时local:
from fabric.api import local
def say_hi():
local("echo hi!")
Run Code Online (Sandbox Code Playgroud)
我收到一个错误:
$ fab say_hi
Traceback (most recent call last):
File "/usr/bin/fab", line 5, in <module>
from pkg_resources import load_entry_point
File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 2655, in <module>
working_set.require(__requires__)
File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 648, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 546, in resolve
raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: paramiko>=1.10.0
Run Code Online (Sandbox Code Playgroud)
我已经安装了paramiko使用 yum install python-paramiko
但这没有帮助.
一直试图阅读代码,但我太'noob'得到它.潜伏在IRC几天,似乎也没有人在那里回答我.
任何想法我怎么能解决这个问题?
网络上有很多关于这个问题的主题,但我似乎无法找到我的具体案例的答案。
我有一个 CSV 文件。我不确定对它做了什么,但是当我尝试打开它时,我得到:
UnicodeDecodeError: 'utf8' 编解码器无法解码位置 0 中的字节 0xff:起始字节无效
这是一个完整的Traceback:
Traceback (most recent call last):
File "keywords.py", line 31, in <module>
main()
File "keywords.py", line 28, in main
get_csv(file_full_path)
File "keywords.py", line 19, in get_csv
for row in reader:
UnicodeEncodeError: 'ascii' codec can't encode character u'\u5a07' in position 10: ordinal not in range(128)
Run Code Online (Sandbox Code Playgroud)
在 Stack Overflow 的帮助下,我打开了它:
reader = csv.reader(codecs.open(file_full_path, 'rU', 'UTF-16'), delimiter='\t', quotechar='"')
现在的问题是,当我读取文件时:
def get_csv(file_full_path):
import csv, codecs
reader = csv.reader(codecs.open(file_full_path, 'rU', 'UTF-16'), delimiter='\t', quotechar='"') …Run Code Online (Sandbox Code Playgroud) Xcode 7可用,但我还不想迁移到Swift 2.0.
我有CococaPods的问题.它们似乎是用Swift 2.0或一些新的Xcode功能编译的,因此不起作用:)因为我使用几乎几乎被遗弃且几乎不能维护的pod--我需要一些时间从它们迁移,或者它们迁移到它们Swift 2.0.如何强制Xcode 7以旧方式编译它们?:)
ps我尝试将首选项>位置>命令行工具更改为Xcode 6.4(6E35b),但这似乎不起作用.