谁能帮我...!我只想为图像设置拐角半径,并且图像也必须适合AspectFit比例尺。
如果我给scaleToFill模式,我可以使用下面的代码及其工作正常。但是图像被拉伸了。
self.productImg.layer.cornerRadius = 7
self.productImg.clipsToBounds = true
Run Code Online (Sandbox Code Playgroud)
但是,将比例尺给AspectFit时,如下图所示。
显示的绿色是图像视图,在该图像中图像设置为AspectFit。
实际形象
提供AspectFit模式时的图像
我需要图像,因为它实际上是给定的,并且还必须具有拐角半径。因此,请任何人给我解决方案以解决此问题。
提前致谢...!
嗨,我只想用图像显示推送通知.我使用下面的代码,我不知道我在哪里做错了它花了我超过3周,我经历了很多链接但仍然无法修复.以下是我的App委托代码
AppDelegate.Swift
import UIKit
import UserNotifications
var deviceTokenString:String = ""
var badgeCount = 0
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Push Notification
if #available(iOS 10.0, *)
{
let center = UNUserNotificationCenter.current()
center.requestAuthorization(options: [.alert, .badge, .sound]) { (granted, error) in
// actions based on whether notifications were authorised or not
guard error == nil else {
//Display Error.. Handle Error.. etc..
return
}
if granted …Run Code Online (Sandbox Code Playgroud)