ios - 屏幕边界扩展可见区域

标签 ios uiview

我试图在主视图的右下角制作一个正方形 (50 x 50) UIView,但我对为什么它不完全可见感到困惑。在这种情况下,从底部只能看到它的尖端。我混淆了一些概念吗?

    CGFloat width = CGRectGetWidth(self.view.bounds);
    CGFloat height = CGRectGetHeight(self.view.bounds);
    UIView *transparentFloater = [[UIView alloc] initWithFrame:CGRectMake(width - 50.f, height - 50.0f, 50.0f, 50.0f)];

    [self.view addSubview:transparentFloater];

最佳答案

尝试添加自动调整掩码:

transparentFloater.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleLeftMargin;

关于ios - 屏幕边界扩展可见区域,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18821019/

相关文章:

ios - swift ,将数据从类传递到 viewController

objective-c - 仅在 iOS 4 上的 ARC 中为 "Modifying layer that is being finalized"

ios - 使用谓词进行过滤需要花费大量时间

ios - 包装器不将其内在内容大小视为其子项以及它们之间的约束的总和

ios - 如何将 UIView 的边框放在 UIImage 后面?

objective-c - iOS - 为圆角矩形创建 UIView 子类

iPhone - 如何通过基于度数的位置获取方向

ios - 如何更新之前在代码中设置的 NSLayoutConstraint 常量? - swift

ios - 不使用renderInContext捕获UIView :

ios - drawInRect 方法运行速度太慢