小编Leo*_*ica的帖子

无法同时满足约束,将尝试通过违反约束来恢复

以下是我在调试区域收到的错误消息.它运行正常,没有任何错误,除了我收到此错误.这会阻止苹果接受应用吗?我如何解决它?

2012-07-26 01:58:18.621 Rolo[33597:11303] Unable to simultaneously satisfy constraints.
    Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or constraints and fix it. (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints) 
(
    "<NSAutoresizingMaskLayoutConstraint:0x887d630 h=--& v=--& V:[UIButtonLabel:0x886ed80(19)]>",
    "<NSAutoresizingMaskLayoutConstraint:0x887d5f0 h=--& …
Run Code Online (Sandbox Code Playgroud)

debugging objective-c ios nslayoutconstraint

140
推荐指数
8
解决办法
13万
查看次数

禁用按钮

我想UIButton在点击后禁用iOS上的按钮().我是iOS的新手,但我认为目标上的等效代码 - C是这样的:

button.enabled = NO;
Run Code Online (Sandbox Code Playgroud)

但我不能迅速做到这一点.

uibutton swift ios8

86
推荐指数
6
解决办法
9万
查看次数

在iOS8 - iOS11中从动作表的委托中以模态方式呈现视图控制器

所以我注意到在iPad上的iOS8 beta 3(更新:仍然发生在iOS 11.2中),当尝试从a的委托方法中呈现视图控制器时UIActionSheet,"没有"发生并且日志消息输出到调试控制台,说明在转换警报控制器时尝试演示:

Warning: Attempt to present <UIViewController: 0x...> on <ViewController: 0x...> which is already presenting <UIAlertController: 0x...>
Run Code Online (Sandbox Code Playgroud)

uikit uiactionsheet ios uialertcontroller

58
推荐指数
2
解决办法
3万
查看次数

iOS CarPlay API是公开的吗?如何整合CarPlay?

CarPlay API可公开获得的?

我们在哪里可以找到编程指南或这些类的引用?

或者它会与其他API如音频无缝集成AVFoundation吗?

笔记

  • 这个问题很广泛,可能会被标记为,但请不要好像几乎没有关于这个主题的信息,很多人在这个阶段发现它很有用
  • 我住在瑞士,想去日内瓦尝试一个我会在法拉利上写的演示应用程序.

ios carplay

48
推荐指数
4
解决办法
3万
查看次数

iOS中的monospace字体是什么?

我想在我的iOS应用程序中为我的UILabel使用等宽字体.

不幸的是,我找不到一个.甚至"美国打字机"实际上并不是等宽的.什么是XCode中可用的等宽字体?

fonts ios

45
推荐指数
7
解决办法
3万
查看次数

如何获取捆绑ID?

我正在努力让facebook API适用于iOS,FB注册页面需要项目的Bundle ID.我怎样才能获得这些信息?我读了一些关于在运行时获取它的内容,但有没有办法让Xcode告诉我这些信息,或者它是否存在于某个地方.我没有使用默认的包ID,我记得在创建项目时设置它.

nsbundle ios

36
推荐指数
5
解决办法
6万
查看次数

如何为iPhone 5屏幕尺寸命名图像?

4英寸视网膜显示器图像的新命名约定是什么?

对于名为的图像,background.png您将@ 2x添加到name(background@2x.png)以告知iOS将其用于具有视网膜显示的设备.

iPhone 5的屏幕尺寸后缀是什么?

iphone cocoa-touch ios ios6 ios7

29
推荐指数
1
解决办法
9752
查看次数

需要方法参数的类型和协议

我正在玩Swift并且遇到以下问题:鉴于我有预定义的类Animal:

//Predefined classes
class Animal {
    var height: Float = 0.0
}
Run Code Online (Sandbox Code Playgroud)

我现在Zoo用接受动物的构造函数编写类.但是Zoo希望每只动物都有一个名字,因此定义了Namable协议.

protocol Namable {
    var name: String {get}
}

class Zoo {
    var animals: Animal[] = [];
}
Run Code Online (Sandbox Code Playgroud)

您如何编写一个addAnimal方法,要求将对象作为参数传递为类型 Animal符合协议 Namable?你如何为animals阵列声明?

    func addAnimal:(animal: ????) { ... }
Run Code Online (Sandbox Code Playgroud)

在Objective-C中,我会写这样的东西

    - (void)addAnimal:(Animal<Namable>*)animal {...}
Run Code Online (Sandbox Code Playgroud)

xcode cocoa protocols ios swift

26
推荐指数
1
解决办法
5922
查看次数

将UIImage转换为灰度,保持图像质量

我有这个扩展(找到obj-c并将其转换为Swift3)以获得相同UIImage但灰度:

public func getGrayScale() -> UIImage
{
    let imgRect = CGRect(x: 0, y: 0, width: width, height: height)

    let colorSpace = CGColorSpaceCreateDeviceGray()

    let context = CGContext(data: nil, width: Int(width), height: Int(height), bitsPerComponent: 8, bytesPerRow: 0, space: colorSpace, bitmapInfo: CGBitmapInfo(rawValue: CGImageAlphaInfo.none.rawValue).rawValue)
    context?.draw(self.cgImage!, in: imgRect)

    let imageRef = context!.makeImage()
    let newImg = UIImage(cgImage: imageRef!)

    return newImg
}
Run Code Online (Sandbox Code Playgroud)

我可以看到灰色图像,但它的质量非常糟糕......我唯一能看到的与质量相关的是bitsPerComponent: 8在上下文构造函数中.然而,看看Apple的文档,这是我得到的:

在此输入图像描述

它表明iOS只支持8bpc ......那么为什么我不能提高质量呢?

uiimage grayscale swift

19
推荐指数
6
解决办法
2万
查看次数

如何使用ios图表设置x轴标签

我最近开始使用ios图表库,但很难找到有关如何使用swift3更新操作x轴的信息.

我想要做的是用时间值标记x轴,例如2:03:00,2:03:01,2:03:02等.在我在网上找到的教程中,这似乎很容易; 他们中的许多人使用一年中的几个月作为x轴标签.

但是,在swift3更新中,图表现在使用x和y值初始化值,我不知道如何在此版本的库中使用标签.有谁知道如何使用swift3在图表中创建标签?

ios swift ios-charts swift3

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