小编Kru*_*nal的帖子

如何在firebase控制台中使用Apple的新.p8证书进行APN

随着最近苹果开发者帐户的升级,我面临着一个困难,即在尝试创建推送通知证书时,它提供了(.p8)证书,而不是可以导出到(.p12)的APN.

Firebase控制台只接受(.p12)证书,以便我可以从这些新的(.p8)证书中获取证书.

apple-push-notifications ios firebase p12 p8

70
推荐指数
7
解决办法
8万
查看次数

UITableView单元的动态高度问题(Swift)

可变长度的动态文本被注入tableview单元格标签.为了使tableview单元格的高度动态调整,我实现了viewDidLoad():

self.tableView.estimatedRowHeight = 88.0
self.tableView.rowHeight = UITableViewAutomaticDimension
Run Code Online (Sandbox Code Playgroud)

这适用于尚未UITableViewAutomaticDimention滚动到的单元格(在滚动到单元格时调用),但不适用于在加载具有数据的表格时最初在屏幕上呈现的单元格.

我试过简单地重新加载数据(如许多其他资源中所建议的):

self.tableView.reloadData()
Run Code Online (Sandbox Code Playgroud)

在这两个viewDidAppear()viewWillAppear(),这是无济于事.我迷了..有没有人知道如何让xcode渲染最初在屏幕上加载的单元格的动态高度?

如果有更好的替代方法,请告诉我.

xcode row-height uitableview ios swift

69
推荐指数
9
解决办法
10万
查看次数

如何实现CoreData记录的重新排序?

我在我的iPhone应用程序中使用CoreData,但CoreData没有提供允许您重新排序记录的自动方式.我想使用另一列来存储订单信息,但使用连续的数字来排序索引有一个问题.如果我处理大量数据,重新排序记录可能涉及更新订单信息上的大量记录(这有点像改变数组元素的顺序)

实施有效订购方案的最佳方法是什么?

core-data ios

64
推荐指数
5
解决办法
2万
查看次数

核心文本 - NSAttributedString线条高度做得对吗?

我完全沉浸在Core Text的行距中.我正在使用NSAttributedString并在其上指定以下属性: - kCTFontAttributeName - kCTParagraphStyleAttributeName

从这里创建CTFrameSetter并将其绘制到上下文中.

在段落样式属性中,我想指定行的高度.

当我使用kCTParagraphStyleSpecifierLineHeightMultiple时,每一行都会在文本顶部接收填充,而不是在此高度的中间显示文本.

当我使用kCTParagraphStyleSpecifierLineSpacing时,填充将添加到文本的底部.

请帮助我达到指定的行高,文本(字形)位于该高度的中间,而不是位于行的底部或顶部的文本.

如果没有明确创建CTLine的路线等,这是不可能的?

nsattributedstring core-text line-spacing

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

Xcode 9:无法附加到pid

最近我主要发布了iOS应用程序开发工具Xcode 9-beta的一个问题(经常).

它在Simulator(iOS 11)中运行/调试应用程序时经常显示以下错误.

无法附加到pid:"2370"
确保< 项目标题 >尚未运行,< 系统用户名 >有权调试它.

以下是同一问题的快照:

错误消息 - 无法附加到pid

什么是这个问题的永久解决方案,因为它经常令人不安?

xcode ios xcode9

55
推荐指数
12
解决办法
3万
查看次数

在Swift 3中更改状态栏背景颜色

在XCode 7.3.x中,我使用以下命令更改了StatusBar的背景颜色:

func setStatusBarBackgroundColor(color: UIColor) {
guard  let statusBar = UIApplication.sharedApplication().valueForKey("statusBarWindow")?.valueForKey("statusBar") as? UIView else {
    return
}
statusBar.backgroundColor = color
}
Run Code Online (Sandbox Code Playgroud)

但似乎这不再适用于Swift 3.0.

我尝试过:

func setStatusBarBackgroundColor(color: UIColor) {
guard  let statusBar = (UIApplication.shared.value(forKey: "statusBarWindow") as AnyObject).value(forKey: "statusBar") as? UIView else {
    return
}
statusBar.backgroundColor = color
}
Run Code Online (Sandbox Code Playgroud)

但它给了我:

this class is not key value coding-compliant for the key statusBar.
Run Code Online (Sandbox Code Playgroud)

任何想法如何使用XCode8/Swift 3.0进行更改?

statusbar ios uistatusbar swift swift3

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

NSDate - 将日期转换为GMT

我需要能够将NSDate值转换为GMT日期.

如何将NSDate值转换为GMT格式的NSDate值,与iPhone设备使用的日期区域设置无关?

objective-c nsdate gmt ios swift

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

默认情况下启用代码折叠

有没有办法在打开文件时默认告诉XCode折叠方法/函数?

xcode code-folding xcode9 xcode10

50
推荐指数
6
解决办法
3万
查看次数

以编程方式更新高度约束

我是汽车布局的新手.我已经完成了xib文件中的所有项目,但现在我遇到了一个问题,我必须以编程方式更新视图的高度.我试过下面但现在正在努力.

[[self view] addConstraint:[NSLayoutConstraint constraintWithItem:loginContainer attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0f constant:loginFrame.size.height]];
Run Code Online (Sandbox Code Playgroud)

在控制台中显示

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 …
Run Code Online (Sandbox Code Playgroud)

objective-c ios autolayout nslayoutconstraint swift

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

Swift - 相当于IBOutletCollection

我正试图在Swift的iTu​​nesU中为"为iphone和ipad开发ios7应用程序"复制斯坦福Matchismo游戏.

在第3讲幻灯片的第77页,它显示使用的IBOutletCollection不是Swift上的选项.Swift doc示例显示了一个包含数组的示例IBOutlet,但我无法弄清楚如何使Interface Builder将多个出口连接到同一个IBOutlet/ IBOutletArray.

有没有人想出怎么做呢?

我知道我可以创建12个插座并以这种方式处理它,但是我想尽可能地使这个工作尽可能地与演讲幻灯片中的示例相关.

interface-builder iboutlet iboutletcollection swift

49
推荐指数
5
解决办法
3万
查看次数