草庐IT

ios - 无法在 UITableviewcell 的 ios 11 layoutsubview subview 中找到 UITableViewCellDeleteConfirmationView?

我必须覆盖Tableviewcell中的高度滑动删除按钮我使用了下面的代码,它在ios10中工作正常但在ios11中我无法在layoutsubview类中找到UITableViewCellDeleteConfirmationViewforeach(varviewsinthis.Subviews){if(views.Class.Name.ToString()==newNSString("UITableViewCellDeleteConfirmationView")){CGRectnewFrame=views.Frame;CGRectnewframe1=newCGRect(newFrame

ios - Swift - 更改幻灯片的大小以删除 tableView 中的按钮

有没有办法改变删除按钮的大小,以便在tableView中滑动删除?我为单元格制作了自己的边框,因此删除按钮像这样延伸到边框中:相关代码如下:functableView(_tableView:UITableView,trailingSwipeActionsConfigurationForRowAtindexPath:IndexPath)->UISwipeActionsConfiguration?{letdeleteAction=UIContextualAction(style:.destructive,title:"Delete"){(action,view,handler)inself

ios - 当 UIButton 的 subview 是 UITableViewCell 的 subview 或任何其他 View 的 subview 时,设置 UIButton 边缘插入的理想位置是什么

我有一个场景,我需要为添加到UITableViewCell的UIButton更改UIEdgeInsets,我在layoutSubviews中设置了它,但这被调用了很多次,它也适用于init,但我不确定这是否真的是一个地方因为那只会调用一次。overridefunclayoutSubviews(){super.layoutSubviews()ifimageView!=nil{titleEdgeInsets=UIEdgeInsets(top:52,left:-10,bottom:0,right:-10)}}谁能告诉我哪个是理想的地方,为什么? 最佳答案

ios - self.view.subviews 在 iOS 8 中为空

我用xib创建了自定义UIViewController,现在我想从中获取第一个subview...它适用于iOS9,但在iOS8view.subviews上有0个ViewletcustomVC=CustomViewController()varcustomTestView=customVC.view.subviews.firstself.view应该有1个subview 最佳答案 如果你用xib创建ViewController,你应该使用它来初始化ViewControllerletvc=CustomViewController(ni

ios - 在 subview Controller 中取消初始化

我有一个标签栏Controller,其中一个标签包含一个表格View。单击一行时,我会转到一个新的子Controller。在这个新Controller中,我有一个deinit删除观察者并打印“controllerisde-initialisedhere”。当我按下导航栏中的后退按钮时,我可以看到此操作调用了de-init。现在...我在那个子Controller中有另一种方法,它设置选项卡栏Controller的事件选项卡。发生此操作时,我没有看到表明在这种情况下未调用de-init的打印语句。我想知道如何解决这个问题?我担心如果不调用deinit,我会在内存中保留额外的东西。更新:在

ios - 如何在 subview Controller 中显示 segue?

我有一个主视图Controller,在这个ViewController中我显示另一个ViewController作为它的subviewController。显示subviewController的代码如下所示。self.currentController是位于主Controller内的子Controller。self.addChildViewController(self.currentController!)self.currentController?.view.frame=self.operationView.boundsself.currentController?.view.

ios - 动画 UIImageView 从 subview 到父 View

我正在从事一个允许用户下棋的项目。我有一个代表板的父View,每个方block都作为subview添加到板中。棋子是一个UIImageView并作为subview添加到正方形。occupyingPieceImageView=UIImageView(frame:CGRectMake(0,0,size,size))self.addSubview(occupyingPieceImageView)为了制作国际象棋移动动画,我想将棋子的位置从一个正方形更改为另一个正方形,我知道这意味着更改UIImageView的框架,但我不知道如何,该框架仅在其父View中(正方形).这不起作用:funcmov

ios - 扩展,选择器并通过扩展添加 subview

我有一个常见的功能,即在我的应用程序的几乎所有页面中显示角设置列表。我想到了使用扩展来实现这个通用功能。我的代码-我创建了一个NSObject子类,其中有一个UIViewController的扩展-importUIKitclassviewControllerExtension:NSObject{}extensionUIViewController{funcsetCornerSettingsTableView(){letmaskView=UIView()maskView.frame=self.view.boundsmaskView.backgroundColor=UIColor.ligh

ios - 将 subview 添加到保留周期的 View 中吗?

我需要知道这是否是一个保留周期。我在泄漏仪器中运行了它,但没有发现任何泄漏。classmyClass:UICollectionViewCell{varaView=UIView()functest(){self.addSubView(aView)}} 最佳答案 此代码不会导致保留循环,但在实践中也不起作用。需要使用(合适的)框架初始化View。 关于ios-将subview添加到保留周期的View中吗?,我们在StackOverflow上找到一个类似的问题: h

ios - 当 subview 重叠时移动 AVPlayer 字幕

如果subview(非本地自定义播放器控件)出现在视频上方,是否可以移动为视频显示的系统字幕?显示的字幕是文本WebVTT字幕。在某些屏幕尺寸上,当我切换到横向时,我们的自定义搜索栏控件会重叠出现在播放器底部的字幕。 最佳答案 就其值(value)而言,这是可能的。您需要访问AVPlayer的当前项目并为其设置AVTextStyleRule。//currentPlayerisourinstanceoftheAVPlayerifletcurrItem=currentPlayer?.currentItem,letrule=AVTextS