草庐IT

layer-item

全部标签

ios - 取消 UIView 动画 - self.view.layer removeAllAnimations 不工作

我有一个UIView动画正在进行,我需要在我的iOS应用程序中取消它。我试过这个:[self.view.layerremoveAllAnimations];但是没有用。动画继续。这是我的动画代码:[UIViewanimateWithDuration:1.4delay:0options:UIViewAnimationOptionCurveEaseOutanimations:^{recognizer.view.transform=CGAffineTransformTranslate(recognizer.view.transform,translation.x,translation.y)

ios - CALayers 从不称其为委托(delegate)的 drawLayer :inContext: even after [layer setNeedsDisplay] and [layer display]

我不明白为什么我创建的CALayer没有调用它们的drawLayer方法。我已经为他们创建了一个drawLayer委托(delegate)对象,但它从未被调用过。来自UIView子类:-(id)initWithFrame:(CGRect)frame{self=[superinitWithFrame:frame];if(self){UIView*bg=[[UIViewalloc]initWithFrame:self.bounds];//Ihaveapropertycalled'bg'toreferencethechildUIViewself.bg=bg;[selfaddSubview:s

ios - CALayers 从不称其为委托(delegate)的 drawLayer :inContext: even after [layer setNeedsDisplay] and [layer display]

我不明白为什么我创建的CALayer没有调用它们的drawLayer方法。我已经为他们创建了一个drawLayer委托(delegate)对象,但它从未被调用过。来自UIView子类:-(id)initWithFrame:(CGRect)frame{self=[superinitWithFrame:frame];if(self){UIView*bg=[[UIViewalloc]initWithFrame:self.bounds];//Ihaveapropertycalled'bg'toreferencethechildUIViewself.bg=bg;[selfaddSubview:s

ios - Show Blended Layers 显示红色 UIImage 但它没有 alpha channel

我有一张没有alphachannel的图像-我在Finder的“获取信息”面板中确认过。然而,当我将它放在UIImageView中时,它位于UIScrollView中,并且我启用了ShowBlendedLayers,图像是红色的,这表明它正在尝试应用透明度,这将很受欢迎性能上。如何将其设置为绿色,以便iOS知道此View中的所有内容都是完全不透明的?我尝试了以下方法,但这并没有去除红色:self.imageView.opaque=YES;self.scrollView.opaque=YES; 最佳答案 默认情况下,UIImage实例

ios - Show Blended Layers 显示红色 UIImage 但它没有 alpha channel

我有一张没有alphachannel的图像-我在Finder的“获取信息”面板中确认过。然而,当我将它放在UIImageView中时,它位于UIScrollView中,并且我启用了ShowBlendedLayers,图像是红色的,这表明它正在尝试应用透明度,这将很受欢迎性能上。如何将其设置为绿色,以便iOS知道此View中的所有内容都是完全不透明的?我尝试了以下方法,但这并没有去除红色:self.imageView.opaque=YES;self.scrollView.opaque=YES; 最佳答案 默认情况下,UIImage实例

ios - Bar Button Item 中只有一个 tab bar controller 导航栏

我有一个带有4个ViewController的标签栏Controller,并且在导航Controller中有这个标签栏Controller。我只想为标签栏Controller的一个特定ViewController显示一个UIBarButtonItem。我尝试使用以下内容if(tabBarController.selectedViewController==customTourViewController){[tabBarController.navigationItemsetRightBarButtonItem:done];}但是按钮没有显示。如果我将每个ViewController都

ios - Bar Button Item 中只有一个 tab bar controller 导航栏

我有一个带有4个ViewController的标签栏Controller,并且在导航Controller中有这个标签栏Controller。我只想为标签栏Controller的一个特定ViewController显示一个UIBarButtonItem。我尝试使用以下内容if(tabBarController.selectedViewController==customTourViewController){[tabBarController.navigationItemsetRightBarButtonItem:done];}但是按钮没有显示。如果我将每个ViewController都

ios - Swift UIViewReportBrokenSuperviewChain 由 Layer 操作引起

将我的代码迁移到Swift3后遇到问题。我猜iOS10现在提出了新问题,它实际上与Swift本身无关。错误:***Terminatingappduetouncaughtexception'NSInternalInconsistencyException',reason:'Viewhaslosttrackofitssuperview,mostlikelythroughunsupporteduseofCALayerAPIontheview'slayer.Ifthisisn'tacrashyet,itwillbeinthenearfuture.Problemview:>Expectedpar

ios - Swift UIViewReportBrokenSuperviewChain 由 Layer 操作引起

将我的代码迁移到Swift3后遇到问题。我猜iOS10现在提出了新问题,它实际上与Swift本身无关。错误:***Terminatingappduetouncaughtexception'NSInternalInconsistencyException',reason:'Viewhaslosttrackofitssuperview,mostlikelythroughunsupporteduseofCALayerAPIontheview'slayer.Ifthisisn'tacrashyet,itwillbeinthenearfuture.Problemview:>Expectedpar

ios - UICollectionView 将 Item 置于中心位置

我使用collectionview来显示模型和年份,用户可以滑动单元格。被选中的单元格将被定位到居中,而不取决于项目的数量。如有任何帮助,我们将不胜感激。 最佳答案 解决方案1:collectionView.scrollToItemAtIndexPath(indexPath,atScrollPosition:.centeredHorizontally,animated:true)解决方案2:我建议你在开头和结尾添加空项。因此用户可以将第一个和最后一个可见项目滚动到中心。 关于ios-UI