Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/joomla/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Swift 如何设置圆形导航栏按钮项?_Swift_Xcode - Fatal编程技术网

Swift 如何设置圆形导航栏按钮项?

Swift 如何设置圆形导航栏按钮项?,swift,xcode,Swift,Xcode,屏幕视图: let json = JSON(value) let profileImagebase64Data = json["user"]["ProfilePhoto"].string profileImage = self.convertBase64StringToImage(imageBase64String: profileImagebase64Data!) let button

屏幕视图:

let json = JSON(value)
            
let profileImagebase64Data = json["user"]["ProfilePhoto"].string
            
profileImage = self.convertBase64StringToImage(imageBase64String:        profileImagebase64Data!)

let button = UIButton()
button.frame = CGRect(x: 0, y: 0, width: 40, height: 40)
button.setImage(profileImage, for: .normal)
button.layer.cornerRadius = 0.5 * button.bounds.size.width
let barButton = UIBarButtonItem()
barButton.customView = button
self.navigationItem.leftBarButtonItem = barButton


您可以添加
button.cliptobunds=true
,还可以检查
button.bounds.size.width
的值。我检查button.bounds.size.width和结果40.0。当我添加“button.cliptobund=true”时,角的锐度就消失了。