- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试将自定义 UIView 置于 UITableViewCell 的中心。在我看来,这是相当基本的东西。我使用这段代码创建了 UIView,我在 stackoverflow 上找到了它:
class SkeletonView: UIView {
var startLocations : [NSNumber] = [-1.0,-0.5, 0.0]
var endLocations : [NSNumber] = [1.0,1.5, 2.0]
var gradientBackgroundColor : CGColor = UIColor(white: 0.85, alpha: 1.0).cgColor
var gradientMovingColor : CGColor = UIColor(white: 0.75, alpha: 1.0).cgColor
var movingAnimationDuration : CFTimeInterval = 0.8
var delayBetweenAnimationLoops : CFTimeInterval = 1.0
lazy var gradientLayer : CAGradientLayer = {
let gradientLayer = CAGradientLayer()
gradientLayer.frame = self.bounds
gradientLayer.startPoint = CGPoint(x: 0.0, y: 1.0)
gradientLayer.endPoint = CGPoint(x: 1.0, y: 1.0)
gradientLayer.colors = [
gradientBackgroundColor,
gradientMovingColor,
gradientBackgroundColor
]
gradientLayer.locations = self.startLocations
self.layer.addSublayer(gradientLayer)
return gradientLayer
}()
func startAnimating(){
let animation = CABasicAnimation(keyPath: "locations")
animation.fromValue = self.startLocations
animation.toValue = self.endLocations
animation.duration = self.movingAnimationDuration
animation.timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeInEaseOut)
let animationGroup = CAAnimationGroup()
animationGroup.duration = self.movingAnimationDuration + self.delayBetweenAnimationLoops
animationGroup.animations = [animation]
animationGroup.repeatCount = .infinity
self.gradientLayer.add(animationGroup, forKey: animation.keyPath)
}
func stopAnimating() {
self.gradientLayer.removeAllAnimations()
}
}
然后我刚刚向我的单元格 xib 添加了一个 View ,水平居中,前缘 +15,顶部 +15 和底部 +15(优先级为 900,这样自动布局就不会因为高度为 320 而不是计算出来的而感到害怕)值为 320.1)。这样它就会在 xib 预览中居中。
运行应用程序时,它看起来像这样,您可以看到左侧有一个间隙,但右侧没有,因此它不居中:
最佳答案
关于swift - 将 View 置于 UITableViewCell 的中心?看起来位于 UI 层次结构的中心,但不在实际的应用程序中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59735376/
我一直听到关于这个话题的相互矛盾的事实。什么是正确的? 最佳答案 你一直听到相互矛盾的观点,因为这是一个非常困惑的话题,即使在高级工程师中也是如此。简而言之,简单地将程序集放置在 GAC 中确实会隐含
我想看看 shlex对于我正在尝试构建的东西来说是一个不错的选择,所以我想我会把它放在 debug mode 中玩弄它。只有 shlex 的构造函数有这个 weird thing it does :
我想在订阅上设置拒绝规则,以便可以使用自定义角色覆盖贡献者访问权限(但有一些异常(exception)情况)。 我在 MS 门户 ( https://learn.microsoft.com/en-us
我在我的 centos 上手动安装了 Artifactory(V 2.6),并将它与自己的独立码头容器一起使用。我使用 artifactoryctl start 启动它,现在我可以使用 http://
我试图将 TextView 置于表格行内,该 TextView 本身位于表格布局内,但我想我错过了一些东西,因为 TextView 没有居中:s 这是我的方法: private void insert
如果问题已经问过,请随意将此帖子作为重复,我还没有找到与此相同的帖子 据我所知,没有必要return在 void 功能 ,例如: void ex () {printf ("Hi\n");} 但是,如果
我想要做的是将 JMenuItem 元素置于 JPopupMenu 的中心。这就是它们目前的样子 我希望它们位于中间而不是左侧。 这是我的代码的一些部分 JButton lvlBtn = ne
我想创建一个包含许多 JComboBox 的调色板。像这样: for(int x=0; x(new String[] { "First Option", "Second Option", "Third
我有一个 TabBar,我想在上面添加 UIButton,但它位于 tabBar 的后面: 图片( http://i.stack.imgur.com/RxGXb.png ) 如何将其置于前面并覆盖 T
如何以编程方式将 UIActivityViewIndicator 置于 UITableViewCell 中? 最佳答案 在 UITableViewController 的自定义子类中尝试类似的操作:
我似乎无法让 PHP 在 Javascript 标记内回显: places.push(new google.maps.LatLng("")); 我做错了什么? 最佳答案 你试过不加引号吗? place
我正在尝试将 X 和 Y 轴中心的 imageView 显示到 scrollView 上,当我运行应用程序时,它很好地适合设备的宽度。我还想平移和缩放imageView。我已经尝试了几乎所有已发布在
非常感谢您对我的问题提供帮助。 我正在使用 JavaFX 和 NetBeans IDE。我正在为桌面客户端制作一个非常简单的启动窗口。该窗口当前看起来像这个图像。 当前外观: 想要的外观(用油漆编辑)
在下面的屏幕截图中,复选框没有在上面的编辑文本下方居中。我怎样才能使复选框居中,使其在编辑文本的正下方居中? 我用来生成上述 UI 的布局是: 布局 XML 事情,我已经尝试过 Check
一直在尝试创建一个基本上具有背景的程序(使用 Paint() 绘制),然后在其上方放置一个带有图像的标签。 继续获取 Paint 下面的 JLabel... 有什么想法吗? 提前非常感谢。 publi
我在 ScrollView 布局内部的 React Native 项目中使用 FAB。正如预期的那样,FAB 位于 ScrollView 的末尾。 如何将它始终放在 ScrollView 的顶部? 下
尽管文本长度大小不同,但我试图将文本直接对齐在每个图标下方。在这张截图中,我希望一切都以这一行为中心: 我曾尝试使用线性和相对布局来获得我想要的内容,但没有成功。这段代码是我现在拥有的,也是最接近我想
我的应用程序运行良好,但我需要通过 SaveFormController 获取 SaveForm。我需要更改 ApplicationMainFormController 中的 ButtonFuncti
我试图将 UIImageView 置于 ScrollView 的中心。这是我尝试过的代码,但没有结果。 UIImageView *iv = [[UIImageView alloc] initWithI
我有一个包含 MKMapView 和 UIImageView 的 View 。 MKMapView 通过在其自动对齐上设置的约束来定位。对于 ImageView ,我想以编程方式将图像的中心定位在 I
我是一名优秀的程序员,十分优秀!