Tag: uikit

在Storyboard中具有不同单元大小和单元格内容的UITableViewController

我想要使​​用不同的单元格大小和不同的单元格内容的UITableViewController 。 例如: 有AutoLayout在Storyboard使用AutoLayout的方式来定义TableViewCells的不同大小? 定义TableViewCells的内容(包含内容的UIView )的最好方法是什么?

在Quartz2D中使用UIImage或UILabel或NSString是否有任何性能或内存开销?

在Quartz2D使用UIImage或UILabel或NSString是否有任何性能或内存开销? 如果没有区别,那么为什么不使用UIImage , UILabel等 可以任何一个给我的片段如何绘制图像,而不使用UIImage 。 在此先感谢,关心。 请纠正我,如果你看到我对这个新的愚蠢的错误,试图学习它。

iOS7:UIImageView永远出现

我有一个使用GCD创build和插入视图的UIView 。 它在iOS7上工作,但UIImageView永远显示。 这是我正在使用的示例代码。 UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, 320, 120)]; for (int i = 0; i < 200; i++) { UIView *view = [[UIView alloc] initWithFrame:CGRectMake(77 * i, 0, 77, 88)]; [scrollView addSubview:view]; dispatch_queue_t queue = dispatch_queue_create("image", NULL); dispatch_async(queue, ^{ UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"photo@hd.png"]]; imageView.frame = CGRectMake(0, 0, 77, […]

获得UIView的可视化

假设UIView只是沿着边缘被裁剪(没有其他的视图在中间的某个地方被CGRect ,把任意UIView的可见矩形作为CGRect ,最简单的方法是什么? 为了清楚起见,这个方法不仅要检索相对于视图的超级视图的可见矩形。 但相对于所有的祖先来说,至less也是相对于所有的兄弟姐妹来说都是如此。

内存问题与CGlayer

我正在绘制CGlayers。 我已经实现了绘图部分,用户绘制的drawingView(canvas)是dynamic的,我的意思是用户可以增加/减lessdrawingView(Canvas)的高度, 例如默认大小 – 500 * 200 当用户点击扩展button – 500 * 300 所以这里是我的function,当用户扩大canvas, – (void)IncreaseCanavasSize { CGContextRef layerContext1 = CGLayerGetContext(permanentDrawingLayer ); CGContextDrawLayerInRect(layerContext1, rectSize, newDrawingLayer); rectSize = self.bounds; CGFloat scale = self.contentScaleFactor; CGRect bounds = CGRectMake(0, 0, self.bounds.size.width * scale, self.bounds.size.height * scale); CGLayerRef layer = CGLayerCreateWithContext(layerContext1, bounds.size, NULL); CGContextRef layerContext = CGLayerGetContext(layer); CGContextScaleCTM(layerContext, scale, scale); […]

UIView在其图层被animation后显示不正确

我有一个问题,我不明白UIViews和核心animation。 这是我想要做的: 将小视图作为其子视图之一呈现在更大的视图之上。 当我点击这个视图中的button时,视图应该最小化并移动到指定的CGRect。 然后,视图将从其超级视图中移除。 我第一次介绍,最小化和移动并删除视图,一切工作正常。 但是当我再次呈现视图时,它会显示在修改后的位置(尽pipe它应该通过调用theView.frame = CGRectMake(600.0, 160.0, 339.0, 327.0); )来设置原始位置,而所有包含在视图中的不同响应者元素(button,文字浏览等)就像在原始位置一样。 这就像视图和图层被animation所不同步,我不知道如何让它们重新同步。 有像self.view.layer.frame = CGRectMake(600.0, 160.0, 339.0, 327.0); 没有得到任何正确的。 我最小化和移动的animation代码如下: [CATransaction flush]; CABasicAnimation *scale, *translateX, *translateY; CAAnimationGroup *group = [CAAnimationGroup animation]; group.delegate = delegate; group.duration = duration; scale = [CABasicAnimation animationWithKeyPath:@"transform.scale"]; translateX = [CABasicAnimation animationWithKeyPath:@"transform.translation.x"]; translateY = [CABasicAnimation animationWithKeyPath:@"transform.translation.y"]; scale.toValue = [NSNumber numberWithFloat:0.13]; […]

IOS 5无法识别的select器在外观代理发送setBackgroundImage

就像很多开发者一样,我正在玩iOS 5的新function。 我试图使用外观代理来定制我的应用程序。 但在某些方法中,我得到一个错误。 这工作: [[UINavigationBar appearance] setBarStyle:UIBarStyleBlackTranslucent]; //and [[UINavigationBar appearance] setTintColor:[UIColor greenColor]]; 但是当我尝试: [[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:@"toolbar_background.png"]]; 我得到一个无法识别的select器错误: -[_UIAppearance setBackgroundImage:]: unrecognized selector sent to instance 0x153020 *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[_UIAppearance setBackgroundImage:]: unrecognized selector sent to instance 0x153020' *** First throw call stack: (0x3107a8bf 0x3821f1e5 0x3107dacb 0x3107c945 0x30fd7680 0x2fe7 […]

镜像UIView

我有一个透明背景的UIView和一些button。 我想捕捉视图的graphics,缩小它,并重画(镜像)在屏幕上的其他地方。 (在另一个视图之上。)button可以改变,所以它不是静态的。 什么是最好的方法来做到这一点?

animationUISplitViewController的主细节控制器的可见性

在我的UISplitViewController中,我希望主视图控制器只允许在纵向方向或当我的详细信息视图控制器不显示控制器typesMyFullScreenViewController 。 我已经实现了UISplitViewControllerDelegate以适当地指出这一点。 -(BOOL)splitViewController:(UISplitViewController *)svc shouldHideViewController:(UIViewController *)vc inOrientation:(UIInterfaceOrientation)orientation { if (UIInterfaceOrientationIsPortrait(orientation) || [[self.navigationController topViewController] isKindOfClass:[MyFullScreenViewController class]]) { return YES; } return NO; } 但是,UISplitViewController仅在旋转期间调用委托。 所以MyFullScreenViewController实现了一个viewWillAppear:animated和viewWillDisappear:animated 。 – (void)viewWillAppear:(BOOL)animated { [self fakeRotationOfSplitViewController]; [super viewWillAppear:animated]; } – (void)viewWillDisappear:(BOOL)animated { [self fakeRotationOfSplitViewController]; [super viewWillDisappear:animated]; } -(void)fakeRotationOfSplitViewController { UIInterfaceOrientation orientation = [[UIDevice currentDevice] orientation]; CGFloat duration = 1.0f; CGFloat […]

清除UITableViewcaching

我的UITableView数据源根据用户操作在后台线程中得到更新。 我在前台显示细胞。 问题是如果新数据中的行数小于以前数据中的行数,我仍然可以看到在新行之后列出的旧行。 15-20秒后,这些旧的行会自动删除(有时会更快)。 或者,如果我去不同的屏幕,并回到我的tableview(数据源不变),旧的行不再存在。 我的猜测是有一些需要强制删除的caching。 任何想法如何做到这一点? 这是我的代码的快照 dispatch_async(queue, ^{ LoadingCompleted = NO; if ([lbl.text isEqualToString:@""]) { [self getData:month Year:year]; LoadingCompleted = YES; } dispatch_async(dispatch_get_main_queue(), ^{ if (LoadingCompleted) { mainDataSource = mainDataSourceCopy; [self.tableView reloadData]; } ); }); 奇怪的输出,我在我的tableview: 新排1 新排2 老排3 老排4 老排5