小编Rey*_*les的帖子

xcodebuild针对目标依赖项的不同配置文件

我正在尝试使用xcodebuild构建我的应用程序:

xcodebuild -workspace "RG.xcworkspace" -scheme "Production" -configuration "Release" build CONFIGURATION_BUILD_DIR="${TEMP_DIR}" PROVISIONING_PROFILE="1234-5678-9098-7654-3210"
Run Code Online (Sandbox Code Playgroud)

我的计划有两个目标.一个目标是应用程序,另一个是应用程序扩展(我为Safari构建了一个扩展).应用扩展程序是目标依赖项.每个目标都需要单独的配置文件.我不知道如何为依赖项指定PROVISIONING_PROFILE.正如预期的那样,我收到了这个错误:

CodeSign error: code signing is required for product type 'App Extension' in SDK 'iOS 8.1'
Run Code Online (Sandbox Code Playgroud)

StackOverflow和xcodebuild的手册页似乎没有提出任何建议.有谁知道如何使用依赖于两个配置文件的xcodebuild构建项目?

xcode xcodebuild ios

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

UIScrollView - 恢复到没有捕捉的起始位置

如果我不够拖动,我想恢复我的UIScrollView的内容偏移量:

- (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(CGPoint *)targetContentOffset {
    self.endingOffset = scrollView.contentOffset;

    if(abs(verticalOffset) > [self cellHeight] / 9) { // If the user scrolled enough distance, attempt to scroll to the next cell
        ...
    } else if(self.nextCellOrigin.y != 0) { // The scroll view is still scrolling and the user didn't drag enough
        ...
    } else { // If the user didn't drag enough
        self.tableView.decelerationRate = UIScrollViewDecelerationRateNormal;
        (*targetContentOffset) = self.startingOffset;
    }
}
Run Code Online (Sandbox Code Playgroud)

恢复到原始位置的代码位于else部分,它始终有效.但是,当我不够滚动并快速做出手势时,它会快速向后移动.如果我稍微滚动一点,然后保持该位置比平时略长,它会平稳地恢复.

我没有在API参考中找到用户触摸UIScrollView多长时间的任何内容,即使我这样做也不是很明显我怎么能用它来改变我的还原代码的行为.我也尝试使用setContentOffset滚动到这个位置:动画:但这似乎并没有解决这个混蛋.

有任何想法吗?

paging cocoa-touch uitableview uiscrollview ios

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

iOS上具有不对称形状的核心文本

我想在可以占用任何形状的路径中写入文本.现在我可以在其中绘制翻转文本:

NSArray *coordinates = ...;

CGMutablePathRef pathRef = [self objectPathGivenCoordinates:coordinates];

... // Draw the shapes

// Now draw the text    
CGContextSetTextMatrix(context, CGAffineTransformIdentity);

NSAttributedString* attString = [[NSAttributedString alloc] initWithString:@"0,1,2..."];
CTFramesetterRef frameSetter = CTFramesetterCreateWithAttributedString((__bridge CFAttributedStringRef)attString);
CTFrameRef frame = CTFramesetterCreateFrame(frameSetter, CFRangeMake(0, [attString length]), pathRef, NULL);
CTFrameDraw(frame, context);
Run Code Online (Sandbox Code Playgroud)

这产生了这个:

翻转不对称形状的文本

我知道iOS有一个翻转坐标系.大多数解决方案在绘制之前添加这两行:

CGContextTranslateCTM(context, 0, rect.size.height);
CGContextScaleCTM(context, 1.0, -1.0);
Run Code Online (Sandbox Code Playgroud)

但这产生了这个:

现在,文本左右上方写入,但超出路径范围

那么为什么这种技术不起作用呢?在我见过的每个例子中,当文本以对称,剪切或OS X呈现时,使用此技术.如果我们以对称形状绘制文本,我们调用CGContextTranslateCTM()CGContextScaleCTM()有意义.调用CGContextTranslateCTM(context, 0, rect.size.height),将第一个字母的原点移动到顶部.调用CGContextScaleCTM(context, 1, -1)反转Y的方向.如果我们在对称形状上反转Y的方向,它不会改变.可悲的是,我的形状不对称.

这是我考虑过但放弃了

  • 以相同的比例绘制形状和数字(两者都是倒置的),然后UIImageView以某种方式翻转它(1)
  • 不要拨打电话来改变比例或翻译CTM.翻转文本矩阵,CGContextSetTextMatrix()以便从左到右,从下到上绘制文本,并且正面朝上.确定在确定形状的字符串后,形状中剩余多少个额外字符.翻转单词(现在它将从上到下,从右到左,右上方).为每个额外的角色添加空格.现在为每个人CTLine,以某种方式再次反转单词(现在它将从上到下,从左到右,右上方)(2)

为什么我放弃了它们

(1)我无法翻转我的图像.他们总是需要正面朝上

(2)对于其他人知道的简单解决方案,这可能是过度的

quartz-2d core-text ios

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