我试图让我的UIView始终保持在屏幕的右侧:
let yPosition: CGFloat = UIApplication.sharedApplication().statusBarOrientation.isPortrait ? 54.0 : 38.0
self.customView = CustomView(frame: CGRectMake(0, yPosition, 255, 306.8))
self.view.addSubview(self.customView!)
答案 0 :(得分:1)
试试这个:
let yPosition: CGFloat = UIApplication.sharedApplication().statusBarOrientation.isPortrait ? 54.0 : 38.0
self.customView = CustomView()
self.customView!.frame.size = CGSize(width: 255, height: 306.8)
self.customView!.frame.origin = CGPointMake(self.view.frame.size.width - self.customView!.frame.size.width, yPosition)
self.view.addSubview(self.customView!)