gpt4 book ai didi

ios - 在项目中链接新框架是否会对应用程序性能产生负面影响?

转载 作者:行者123 更新时间:2023-11-29 04:18:16 24 4
gpt4 key购买 nike

例如,当我这样编码时:anView.layer.cornerRadius = 5; ,我需要链接QuartzCore.framework在我的项目中并导入 <QuartzCore/QuartzCore.h>在头文件中。

我想知道在链接新框架时这是否会对应用程序性能产生负面影响。

我不确定这一点,所以我总是尝试像这样子类化 UIView。

- (void)drawRect:(CGRect)rect
{
UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect: self.bounds cornerRadius: 5];
[[UIColor colorWithWhite: 0.2 alpha: 0.75] set];
[path fill];
}

最佳答案

编译器肯定会优化代码。如果您链接了一个框架而不导入它,它将忽略链接的框架。就您而言,由于您在该框架中使用了属性 cornerRadius,因此可能会对性能产生轻微影响,但它非常微妙,您不可能感觉到差异。

关于ios - 在项目中链接新框架是否会对应用程序性能产生负面影响?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13358464/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com