Tag: 石英芯

在uitableviewcell中的CABasicAnimation似乎不起作用

我试图用一个CABasicAnimation在tableview单元格内改变背景颜色的标签,它似乎并没有工作 – 单元格背景颜色保持稳定,没有animation。 此代码位于cellForRowAtIndexPath方法中 – (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { MainCellTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath]; NSString *name = @"Hello"; UIColor *color = [UIColor colorWithRed:0.0f/255.0f green:100.0f/255.0f blue:200.0f/255.0f alpha:1.0f]; // I'm setting the label as a strong property of the cell cell.label = [[UILabel alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 100.0f, cell.contentView.frame.size.height)]; cell.label.text = name; cell.label.textColor = [UIColor […]

如何用多种颜色填充CircularProgressBar

我已经使用这个教程链接实现CircularProgress酒吧 但是我想用两种或三种颜色填充这个CircularProgress Bar,而不是只有一种颜色。 我怎么能做到这一点,请帮助我。 提前致谢

UIBezierPath指向小path

给定一个任意的UIBezierPath ,我正在寻找一种方法来得到一个点的path长度的一小部分。 例: UIBezierPath *path = [UIBezierPath bezierPath]; [path moveToPoint:CGPointMake(200.0, 200.0)]; [path addLineToPoint:CGPointMake(200.0, 400.0)]; CGPoint p = [path pointAtFraction:0.5]; 在这种情况下{x: 200.0, y: 300.0} p应该是{x: 200.0, y: 300.0} 。 我知道这个简单的例子可以计算,但我正在寻找一个解决scheme,适合任何UIBezierPath (圆弧,圆angularUIBezierPath等) 看到基本生活在UIBezierPath及其属性strokeEnd ,我想信息是在path对象内的某个地方。 但是, UIBezierPath和CGPathRef接口都不能显示任何方式来实现这一点。 我尝试创build一个CAShapeLayer ,设置strokeEnd并从图层中检索CGPathRef ,但path保持不变。 有没有什么办法(公共API)来实现这一目标?

归属文本背景上的圆angular是否可能?

我用不同的文字颜色归因于文本。 为了更好的可读性突出显示的文本我使用backgroundcolor。 是否有可能在这个Textarea带来圆angular的CALayer效应? 不是整个区域,而是内部的特殊文本。 我的代码: NSAttributedString *text = [[NSAttributedString alloc] initWithString:@"Highlighted Text" attributes:@{ NSFontAttributeName: [UIFont fontWithName:@"HelveticaNeue" size:10.0f], NSForegroundColorAttributeName: [UIColor lightGrayColor], NSBackgroundColorAttributeName: [UIColor darkGrayColor] }];

完成之前取消一个UIView animateWithDuration

我在我的项目中有这个代码: – (void) fadeImageView { [UIView animateWithDuration:1.0f delay:0 options:UIViewAnimationCurveEaseInOut animations:^{ self.imageView.alpha = 0.0f; } completion:^(BOOL finished) { //make the image view un-tappable. //if the fade was canceled, set the alpha to 1.0 }]; } 不过,在imageview变得不可见的情况下,我想取消这个操作。 有没有办法取消这个animation中animation?

中风屏蔽了iOS中的CALayer

我试图创build一个标签(或任何其他视图)与一个圆angular和一个笔画/边框。 我可以用以下代码实现前者: UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:self.label.bounds byRoundingCorners:UIRectCornerBottomRight cornerRadii:CGSizeMake(16.0f, 16.0f)]; CAShapeLayer *shape = [CAShapeLayer layer]; shape.frame = self.label.bounds; shape.path = maskPath.CGPath; self.label.layer.mask = shape; 这对圆angular很好,但使用下面的代码不会按照我想要的方式应用笔画。 取而代之的是生成一个黑色(或者任何backgroundColor的self.label被设置为) 方形边框。 UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:self.label.bounds byRoundingCorners:UIRectCornerBottomRight cornerRadii:CGSizeMake(16.0f, 16.0f)]; CAShapeLayer *shape = [CAShapeLayer layer]; shape.frame = self.label.bounds; shape.path = maskPath.CGPath; // Add stroke shape.borderWidth = 1.0f; shape.borderColor = [UIColor […]

淡出任何接近UIScollView边缘的内容

正如标题所说,我试图给一些UIImageView一个淡出效果,因为他们越来越接近我的UIScrollView的四个边缘的任何一个。 由于用户可以拖动UIImages,如果他拖动边缘,它们开始淡出,而不是像UIScrollView边框一样给出这种效果。 我试过这个教程: Adding Fading Gradients to UITableView build议在另一个堆栈溢出的问题,但它只能应用于UITableViews。 我希望图像在离边界一厘米处开始消失。

自定义UISearchbar的UITextfield – iOS

我正在尝试自定义UISearchbar的文本字段。 下面的图片显示了我的一半完成的工作。 我有UISearchbar的子类,并从我的视图控制器调用它。 我正试图从文本字段中删除那些黑灰色的线条。 下面是添加到viewcontroller的子视图的UISearchbar的实现。 searchbar = [[SearchBar alloc] initWithFrame:CGRectMake(35,78, 250, 17)]; searchbar.backgroundColor = [UIColor clearColor]; searchbar.layer.borderColor = [[UIColor clearColor] CGColor]; searchbar.layer.borderWidth = 0; for(UIView *view in searchbar.subviews){ if([view isKindOfClass:[UITextField class]]){ UITextField *tf= (UITextField *)view; tf.layer.borderColor = [[UIColor clearColor] CGColor]; tf.delegate = self; break; } } [self.view addSubview:searchbar]; searchbar.delegate = self; UISearchBar子类: – (id)initWithFrame:(CGRect)frame { […]

从CMSampleBuffer创build一个UIImage

这与关于将CMSampleBuffer转换为UIImage的无数问题并不相同。 我只是想知道为什么我不能像这样转换它: CVPixelBufferRef pixelBuffer = (CVPixelBufferRef)CMSampleBufferGetImageBuffer(sampleBuffer); CIImage * imageFromCoreImageLibrary = [CIImage imageWithCVPixelBuffer: pixelBuffer]; UIImage * imageForUI = [UIImage imageWithCIImage: imageFromCoreImageLibrary]; 这似乎更简单,因为它适用于YCbCr色彩空间,以及RGBA和其他。 这个代码有什么问题吗?

如何在CALayer.contents中添加Stretchable UIImage?

我有一个CALayer,我想添加一个可拉伸的图像。 如果我只是这样做: _layer.contents = (id)[[UIImage imageNamed:@"grayTrim.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(0.0, 15.0, 0.0, 15.0)].CGImage; 它将不起作用,因为图层的默认contentGravity是kCagravityResize。 我读过这可以使用contentsCenter来完成,但我似乎无法弄清楚我将如何使用它来实现CALayer中的拉伸图像。 任何想法都欢迎! 霍拉丘