iphone - 使 ImageView 出现在 Safari Top Sites 中

标签 iphone ios

您可能已经看到,当我们打开 Safari 浏览器并单击 Net Tab 时,图像被放置在曲面屏幕中。它列在顶级站点下。所以我的问题是我有一个 UIImageview,我需要像在 Safari 中一样使该 ImageView 弯曲。我怎样才能做到这一点?我可以使用 QuartzCore 吗?请帮忙..

最佳答案

是的你可以。您只需要从 QuartzCore/QuartzCore.h 对 CATransform3D 进行研究。
您将能够根据需要缩放/旋转/透视您的图像,为它们提供与 Safari 相同形式的站点 View 。不幸的是,实现取决于您,这是一项艰巨的工作。

只是为了不让你“独自在黑暗中”,这里是一个图像的透视图:

UIView *myView = (UIView*)instance_to_your_UIImageView;
    CALayer *layer = myView.layer;
    CATransform3D rotationAndPerspectiveTransform = CATransform3DIdentity;
    rotationAndPerspectiveTransform.m14 = 1.0 / 500;
    rotationAndPerspectiveTransform = CATransform3DRotate(rotationAndPerspectiveTransform, 0.0f, 0.0f, 1.0f, 0.0f);
    layer.transform = rotationAndPerspectiveTransform;

下面是“之前”和“之后”:

BEFORE
AFTER

干杯!

关于iphone - 使 ImageView 出现在 Safari Top Sites 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11537452/

相关文章:

ios - 如何在 iOS 11+ 中以编程方式打开“设置”>“隐私”>“位置服务”?

ios - 如何在 iOS10 (Swift 3) 中获取正在播放歌曲的歌词

iphone - 计算 UILabel 的高度?

iphone - 使用谷歌登录到带有 IOS 5 或更高版本的 iphone sdk

ios - 如何在Cocos2D iPhone中拍摄屏幕截图?

iphone - 来自NS的NSString unichar

ios - 未调用 MFMailComposeViewController 委托(delegate)方法

iphone - 如何使 icon.png 显示在旧 iphone 上,而 icon@2x.png 显示在较新的 iPhone 上?

iphone - 在 UITableViewController 中的通知中心添加观察者的位置

iphone - 在 iPhone 中记录来自蓝牙耳机的输入