我想UIImageView通过添加以下代码行来添加约束:
addConstraint(NSLayoutConstraint.constraintsWithVisualFormat("H:|[v0]|", options: NSLayoutFormatOptions(), metrics: nil, views: ["v0": userProfileImageView]))
Run Code Online (Sandbox Code Playgroud)
但是xcode告诉我这个错误:
我该如何解决这个错误?
我从其网站下载并安装CocoaPods,我的pod版本是pod --version 1.0.0.
当我想安装Alamofire或swiftJSON时,例如,将它们添加到我的podfile并运行 pod install
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
target 'random contact' do
pod 'Alamofire', '~> 3.4'
pod 'SwiftyJSON'
end
Run Code Online (Sandbox Code Playgroud)
我收到此错误:
Analyzing dependencies
[!] Unable to satisfy the following requirements:
- `Alamofire (~> 3.4)` required by `Podfile`
None of your spec sources contain a spec satisfying the dependency: `Alamofire (~> 3.4)`.
You have either:
* out-of-date source repos which you can update with `pod repo update`.
* mistyped the name or version.
* not added …Run Code Online (Sandbox Code Playgroud) 我是一名前端开发人员.当我编写html代码时,我通过复制和粘贴(标题部分,页脚部分等)重复我自己.
我怎么写模块化我的html文件?像独立的header.html和footer.html,都在通话后index.html...一样erb的Ruby on rails?(我不喜欢jade郎)
如何复制一个<div>使用JavaScript的n份副本?
从1开始:
<div class="box"></div>
Run Code Online (Sandbox Code Playgroud)
最终得到5:
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
Run Code Online (Sandbox Code Playgroud) 我通过rbenv安装ruby 2.2.3并安装rails 4.2.1
当我想通过rails -v显示在终端中查看Rails版本时:
Ignoring json-1.8.2 because its extensions are not built. Try: gem pristine json --version 1.8.2
Ignoring json-1.8.3 because its extensions are not built. Try: gem pristine json --version 1.8.3
Ignoring nokogiri-1.6.6.2 because its extensions are not built. Try: gem pristine nokogiri --version 1.6.6.2
Rails 4.2.1
Run Code Online (Sandbox Code Playgroud)
或通过rails new app向我展示此新应用来创建新应用:
Ignoring json-1.8.2 because its extensions are not built. Try: gem pristine json --version 1.8.2
Ignoring json-1.8.3 because its extensions are not built. Try: gem …Run Code Online (Sandbox Code Playgroud) 我创建了一个用于处理选择框的组件,现在当我在提交表单后将其放在表单标签中时,选择的结果不会显示在控制台中.
我的代码有什么问题?我怎样才能解决这个问题?
@Input.这是选择框组件:
import { Component, OnInit, Input } from '@angular/core';
@Component({
selector: 'input-select',
template:`
<div class="field-select">
<span><icon name="select-arrow" size="10"></icon></span>
<select name="{{name}}" class="field">
<option value="0" disabled selected>{{label}}</option>
<option *ngFor="let option of options" [ngValue]="option.value">{{option.name}}</option>
</select>
</div>
`
})
export class InputSelectComponent implements OnInit {
@Input() label: string;
@Input() name: string;
@Input() options;
// testOptions = [
// {value:'test',name:'test2'},
// {value:'test',name:'test2'}
// ];
constructor() { }
ngOnInit() {
console.log(this.options);
}
}
Run Code Online (Sandbox Code Playgroud)
在html中的用法:
<input-select label="test" name="select2" [options]="testOption"></input-select>
Run Code Online (Sandbox Code Playgroud)
表格html:
<form role="form" …Run Code Online (Sandbox Code Playgroud) 我的私钥有一个恼人的问题.每次我想要clone或push通过终端或塔式应用程序中的ssh,我都要输入我的密码.
我甚至删除并重新创建了ssh密钥并在Github上设置了几次密钥,但看起来它的生命周期很短,几分钟后就过期了!
我跟着生成了一个新的SSH密钥来创建密钥.最后我跑了ssh-add ~/.ssh/id_rsa,打印出来:
Identity added: /Users/sajad/.ssh/id_rsa (/Users/sajad/.ssh/id_rsa)
Run Code Online (Sandbox Code Playgroud)
重新启动机器后,我跑去ssh-add -l检查它是否仍然存在,结果如下:
The agent has no identities.
Run Code Online (Sandbox Code Playgroud)
我怎样才能解决这个问题?我用macOS.
我的/etc/ssh/ssh_config:
# $OpenBSD: ssh_config,v 1.30 2016/02/20 23:06:23 sobrado Exp $
# This is the ssh client system-wide configuration file. See
# ssh_config(5) for more information. This file provides defaults for
# users, and the values can be changed in per-user configuration files
# or on the command line.
# Configuration data is …Run Code Online (Sandbox Code Playgroud) 我的父组件中有一个变量,我想在我的子组件中编辑.我尝试@Input但似乎没有用!我怎样才能实现传递var给孩子并听取改变?
家长:
export class Parent implements OnInit {
showModal : boolean = false;
}
Run Code Online (Sandbox Code Playgroud)
儿童:
export class Child implements OnInit {
@Input() showModal: boolean;
// calling this function on (click) button.
closeModal() {
this.showModal = false;
}
}
Run Code Online (Sandbox Code Playgroud)
谢谢.
ios ×4
swift ×4
angular ×2
html ×2
javascript ×2
atom-editor ×1
cocoapods ×1
css ×1
dom ×1
erb ×1
flexbox ×1
git ×1
git-tower ×1
github ×1
gulp ×1
jquery ×1
ruby ×1
ssh ×1
sublimetext ×1
swift2 ×1
terminal ×1
text-editor ×1
uitabbar ×1
uitabbaritem ×1