Tag: uikit

如何使UITableViewCell上的UIProgressView立即改变?

我把一个UIProgressView放在UITableViewCell上,像这样: UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"downloadcell"]; if(cell==nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"downloadcell"] autorelease]; UIProgressView* downPreView = [[UIProgressView alloc] initWithProgressViewStyle:UIProgressViewStyleDefault]; downPreView.tag = 123; downPreView.frame = CGRectMake(400,70, 200,10); [cell.contentView addSubview:downPreView]; } 当下载大小发生变化时,我这样做: UIProgressView* downPreView = (UIProgressView*)[cell viewWithTag:123]; downPreView.progress = downloadPre; 但downPreView的外观不会立即改变,只有当我触摸单元格或其他单元格后,如何使UITableViewCell上的UIProgressView立即改变?

iOS 7 UITableView:这是一个错误还是我?

请参阅附件图片。 在iOS 7的表格视图中,UIKit在附件视图和重新sorting控件之间绘制一条细的灰色垂直线。 但是,当滚动表格视图时,该行不会在某些单元格中绘制。 在附图中的单元格1,2和8中不存在。 为什么是这样? 我该如何解决?

UIView翻转animation

在我的游戏中,我有一个更小的UIViews的网格托pipe在我的主UIView。 随机的框会变成一个不同的颜色,在这一点上,用户可以触摸他们得分。 当他们触摸盒子时,我想展示某种animation,理想情况下类似于XCode原生提供的模式水平翻转细节。 我怎样才能做这个animation,而不需要实际转换到另一个UIView?

UIGraphicsBeginImageContext与iOS上的CGBitmapContextCreate

这可能是一个非常愚蠢的问题,但是有人可以告诉我使用UIGraphicsBeginImageContext创buildCGContextRef和使用CGBitmapContextCreate绘制图像的区别吗? 特别是现在,因为UIKit绘图是线程安全的,我想知道是否有任何理由通过UIGraphicsBeginImageContext使用CGBitmapContextCreate。

将垂直滚动从UIScrollView转移到兄弟UITableView

我有一个视图控制器与这个层次结构: 视图控制器: UIScrollView(水平滚动) UITableView(可垂直滚动) 我想将垂直滚动从我的UIScrollView转发到兄弟UITableView ,以便当用户在UIScrollView上滚动时, UITableView将向上滚动。 什么是最好的办法呢? 我试过这些: 检测scrollViewDidScroll的垂直滚动,它不会被调用,因为滚动视图的contentOffset不会更改。 子类UIScrollView和重写touchesMoved ,我不能转发触摸到表视图,因为我没有在这个类的引用。

在UIView的-drawRect:方法中绘制彩色文本

我想在我的UIView子类中绘制彩色的文字。 现在我正在使用Single View应用程序模板(用于testing)。 除了drawRect:方法之外,没有任何修改。 文本被绘制出来,但是无论我设置什么颜色,它总是黑色的。 – (void)drawRect:(CGRect)rect { UIFont* font = [UIFont fontWithName:@"Arial" size:72]; UIColor* textColor = [UIColor redColor]; NSDictionary* stringAttrs = @{ UITextAttributeFont : font, UITextAttributeTextColor : textColor }; NSAttributedString* attrStr = [[NSAttributedString alloc] initWithString:@"Hello" attributes:stringAttrs]; [attrStr drawAtPoint:CGPointMake(10.f, 10.f)]; } 我也试过[[UIColor redColor] set]无济于事。 回答: NSDictionary * stringAttrs = @ {NSFontAttributeName:font,NSForegroundColorAttributeName:textColor};

如何在tableview中animation图像来同时扩展和打开另一个视图控制器?

我正在做一个信使应用程序,我希望用户点击我的桌面视图中的图像,它应该扩展到全屏幕,并显示导航栏上的不同控件。 我如何去做呢? 我以为我可以采取相同的形象,把UIImageView的原始细胞图像的顶部和animation到全屏幕。 但是我怎样才能在不眨眼,延迟和animation的情况下呈现不同的控制器呢? 这在许多消息应用程序中完成。

UICollectionView与重叠单元格和自定义插入和删除animation

我正在处理一个自定义的UICollectionView +布局,其中的单元格重叠在一起。 最重要的是,我正在实现添加和删除项目的自定义animation。 一切工作正常,除了插入/删除项目时,属性的zIndex属性似乎被忽略。 合适的细胞: 插入一些单元格后: 这是我的自定义插入/删除animation的实现。 我的猜测是问题在这些方法的某处。 override func initialLayoutAttributesForAppearingItemAtIndexPath(itemIndexPath: NSIndexPath) -> UICollectionViewLayoutAttributes? { let attributes = layoutAttributesForItemAtIndexPath(itemIndexPath) for updateItem in updateItems { switch updateItem.updateAction { case .Insert: if updateItem.indexPathAfterUpdate == itemIndexPath { let translation = collectionView!.bounds.height attributes?.transform = CGAffineTransformMakeTranslation(0, translation) break } default: break } } return attributes } override func finalLayoutAttributesForDisappearingItemAtIndexPath(itemIndexPath: NSIndexPath) […]

什么时候轮换适当的时刻来更改UICollectionView的布局参数

希望有一个相对较新的UIKit控件的简单问题 我有一个UICollectionView有一个viewLayout与一个单元格的行,这是在纵向模式下的UICollectionView边界的确切高度 因此,当iPad翻转到横向模式时,该行比屏幕本身更高,此时布局(几乎)静静地失败,并且抱怨该行高于边界。 什么是处理viewLayout的特性的理想方法,特别是涉及到在ViewController响应旋转?

链UIViewanimation与时间间隔

我需要animation3 UIViews(淡入/淡出)。 1animation持续时间为0.6s(淡入/淡出周期为0.6 + 0.6s)。 但是我需要在0.2秒内启动animation。 第一个animation应该在0.0秒内启动。 第二个animation应该在0.2秒内启动。 应该在0.4秒内启动第三个animation。 所有这些都应该“无限期地”循环(直到某个触发器)。 我现在所拥有的: – (void)playAnimation { isAnimated = YES; [self animateView:firstView afterDelay:0.0]; [self animateView:secondView afterDelay:0.2]; [self animateView:thirdView afterDelay:0.4]; } – (void)stopAnimation { isAnimated = NO; } – (void)animateView:(UIView *)animatedView afterDelay:(float)delay { if(isAnimated) { [UIView animateWithDuration:0.6 delay:delay options:UIViewAnimationOptionTransitionNone animations:^ { animatedView.alpha = 1.0; } completion:^(BOOL finished) { [UIView […]