小编Dan*_*iel的帖子

从远程Git存储库中检索特定提交

有没有办法只从远程Git仓库检索一个特定的提交而不在我的PC上克隆它?远程仓库的结构与我的结构完全相同,因此不会有任何冲突,但我不知道如何做到这一点,我不想克隆那个庞大的存储库.

我是git的新手,有什么办法吗?

git git-fetch

178
推荐指数
6
解决办法
34万
查看次数

如何放大故事板(xcode 6)

从昨天开始,新的Xcode6已经发布.是否可以放大故事板视图?

iphone xcode interface-builder xcode6

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

在Swift中动画CAGradientLayer

我正在尝试使用Swift为CAGradientLayer设置动画.对于我正在使用这篇文章的资源

这是我的代码

class ViewController: UIViewController {

  var gradient : CAGradientLayer?;

  override func viewDidLoad() {
    super.viewDidLoad()
  }

  override func viewDidAppear(animated: Bool) {

    self.gradient = CAGradientLayer()
    self.gradient?.frame = self.view.bounds
    self.gradient?.colors = [ UIColor.redColor().CGColor, UIColor.redColor().CGColor]
    self.view.layer.insertSublayer(self.gradient, atIndex: 0)

    animateLayer()
  }

  func animateLayer(){

    var fromColors = self.gradient?.colors
    var toColors: [AnyObject] = [ UIColor.blueColor().CGColor, UIColor.blueColor().CGColor]

    var animation : CABasicAnimation = CABasicAnimation(keyPath: "colors")

    animation.fromValue = fromColors
    animation.toValue = toColors
    animation.duration = 3.00
    animation.removedOnCompletion = true
    animation.fillMode = kCAFillModeForwards
    animation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionLinear)
    animation.delegate = …
Run Code Online (Sandbox Code Playgroud)

objective-c ios swift

17
推荐指数
2
解决办法
9460
查看次数

UIButton在UIScrollview中设置框架后没有响应

我有一个UIScrollView,其内容是使用Interface Builder设计的.它有一个下面有UIButton的桌子.如果按钮之前没有被移动,它可以工作(touchesBegan和TouchUpInside被调用),但如果它是使用'button.frame ='移动以响应内容增长(表格变大),它会停止响应任何触摸.

我确认前面没有隐藏的视图,我甚至使用了bringViewToFront.

iphone cocoa-touch objective-c uibutton

13
推荐指数
1
解决办法
4722
查看次数

iPhone获取所有专辑/艺术家

你们有没有关于如何从iPod媒体库中检索所有音乐专辑或艺术家的示例代码(或其链接)?

提前致谢!

iphone ipod

11
推荐指数
1
解决办法
6490
查看次数

Erlang:谁监督主管?

在我所见过的所有Erlang主管示例中,通常都有一个"主"主管监督整个树(或者至少是主管树中的根节点).如果"主人" - 监督员破裂怎么办?如何监督"主人"监督?任何典型的模式?

erlang erl erlang-supervisor

11
推荐指数
1
解决办法
1259
查看次数

dismissViewControllerAnimated在块中不起作用

我试着关闭UIViewController一个UIAlertController在显示.

这是我的代码:

UIAlertController *alertController = [UIAlertController alertControllerWithTitle:title 
                                                                         message:msg
                                                                  preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"Accept" 
                                                   style:UIAlertActionStyleDefault 
                                                 handler:^(UIAlertAction *action)
             {
                 [self dismissViewControllerAnimated:YES completion:nil];
             }];

[alertController addAction:okAction];
[self presentViewController:alertController animated:YES completion:^{}];
Run Code Online (Sandbox Code Playgroud)

但是,self永远不会被解雇.谁知道如何解决这个问题?

UPDATE

如果我设置[self dismissViewControllerAnimated:YES completion:nil];在块之外,它可以工作.

iphone uiviewcontroller ios uialertcontroller

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

将TODO注释显示为不包括Pods文件夹的警告

我有一个脚本来显示我的所有//TODO:评论,如下所示:

KEYWORDS="TODO:|FIXME:|\?\?\?:|\!\!\!:"

find "${SRCROOT}" \( -name "*.h" -or -name "*.m" -or -name "*.swift" \) -print0 | 
  xargs -0 egrep --with-filename --line-number --only-matching "($KEYWORDS).*\$" | 
  perl -p -e "s/($KEYWORDS)/ warning: \$1/"
Run Code Online (Sandbox Code Playgroud)

我想要排除我的Pods文件夹,因此我添加了-not -path "./Pods/*":

find "${SRCROOT}" \( -name "*.h" -or -name "*.m" -or -name "*.swift" \) -not -path "./Pods/*" -print0 | 
  xargs -0 egrep --with-filename --line-number --only-matching "($KEYWORDS).*\$" | 
  perl -p -e "s/($KEYWORDS)/ warning: \$1/"
Run Code Online (Sandbox Code Playgroud)

当我在终端(替换"${SRCROOT}"".")上尝试它时,这可以正常工作,但是当它由Xcode运行时,它也使用该Pods文件夹.

如何在构建阶段脚本中排除文件夹?

最终版本

这似乎有效: …

bash xcode cocoapods

9
推荐指数
1
解决办法
641
查看次数

检查对象是否不是 swift 类型的

我需要检查一个对象是否不是某种类型。我知道在 Kotlin 中可以通过使用!is. 我想知道 Swift 中是否有等价物,或者如果不可能的话我可以使用的解决方法?

Kotlin 中的示例:

假设动物是不同的动物的接口并有实现它的类,例如CatDogHorseSpider,等:

var animals = listOf<Animals>(Horse(), Cat(), Dog(), Spider())
var chosenAnimals = animals.filter { it !is Spider }
Run Code Online (Sandbox Code Playgroud)

iphone ios swift

9
推荐指数
1
解决办法
6942
查看次数

为什么在erlang中使用OTP?

正如问题所说:使用erlang进行开发时,使用OTP设计原则会带来哪些好处?

(我正在开发一个只接收命令并发送响应的服务器)

erlang erlang-otp erl

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