小编And*_*rew的帖子

将文件捆绑到 iOS 应用程序上的特定文件夹位置

我的应用程序包中的文件被安排到文件夹中,但是当我检查包的文件布局时,似乎这些文件都添加到了同一个目录中,而不是像我在 XCode 中那样按文件夹排序。如何确保它们以相同的文件夹结构添加到设备中?

xcode bundle nsfilemanager ios

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

从 XIB 加载时 UICollectionViewCell 导致崩溃

我有一个UICollectionViewCell子类,它UIView现在只显示一个带有背景颜色的子视图,以表明它在那里。

为了从 XIB 加载,我必须替换它:

- (void)viewDidLoad {
    [super viewDidLoad];
    [self.localPlayerItemsView registerClass:[MBTradeCollectionViewCell class]
                  forCellWithReuseIdentifier:CellIdentifier];
}
Run Code Online (Sandbox Code Playgroud)

有了这个:

- (void)viewDidLoad {
    [super viewDidLoad];
    UINib *nib = [UINib nibWithNibName:@"MBTradeCollectionViewCell" bundle:nil];

    [self.localPlayerItemsView registerNib:nib forCellWithReuseIdentifier:CellIdentifier];
}
Run Code Online (Sandbox Code Playgroud)

这样做后,我会在第一行崩溃collectionView:cellForItemAtIndexPath:

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
    MBTradeCollectionViewCell *aCell = [collectionView dequeueReusableCellWithReuseIdentifier:CellIdentifier
                                                                                forIndexPath:indexPath];

    return aCell;
}
Run Code Online (Sandbox Code Playgroud)

这是崩溃:

*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<NSObject 0x7d461780> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key itemCountView.'
Run Code Online (Sandbox Code Playgroud)

使用 时它不会导致此崩溃registerClass:forCellWithReuseIdentifier: …

xcode objective-c xib ios uicollectionview

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

绘制到 CGContext 时如何设置 UIBezierPath 的线宽?

我正在尝试使用提供的 UIBezierPath 创建一个 UIImage。不幸的是,无论我设置什么setLineWidth,结果总是 1 分:

extension UIBezierPath {
    func image(fillColor: UIColor, strokeColor: UIColor) -> UIImage? {
        UIGraphicsBeginImageContextWithOptions(bounds.size, false, 1.0)
        guard let context = UIGraphicsGetCurrentContext() else {
            return nil
        }

        context.setLineWidth(10)
        context.setFillColor(fillColor.cgColor)
        context.setStrokeColor(strokeColor.cgColor)

        self.fill()
        self.stroke()

        let image = UIGraphicsGetImageFromCurrentImageContext()

        UIGraphicsEndImageContext()

        return image
    }
}
Run Code Online (Sandbox Code Playgroud)

在一个带有圆圈的测试项目中尝试这个,例如:

class ViewController: UIViewController {
    override func viewDidLoad() {
        super.viewDidLoad()

        let imageView = UIImageView()
        imageView.frame = CGRect(x: 100, y: 100, width: 100, height: 100)
        view.addSubview(imageView)

        let bezierPath = UIBezierPath(ovalIn: CGRect(x: 0, y: 0, width: …
Run Code Online (Sandbox Code Playgroud)

core-graphics cgcontext ios uibezierpath swift

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

如何向人们发送我的应用测试版?

每当我向人们询问如何通过电子邮件发送测试版时,他们总是告诉我"噢,这很容易.你只需要输出IPA,然后向每个人发送链接." 我自己做了一个测试员.我点击链接,然后安装.很简单.

而现在我无法找到如何做到这一点.

对我来说,我导出,并通过电子邮件将链接附加到我自己,然后通过"打开方式..."提示将其转发到safari.我无法弄清楚如何安装它.

我对TestFlight或任何涉及更复杂的事情都不感兴趣.我只想向人们发送我的构建,并且无法弄清楚哪个部分我出错了.

iphone xcode adhoc ad-hoc-distribution ios

0
推荐指数
1
解决办法
226
查看次数