我正在使用以下 Swift 代码来截取我的应用程序的屏幕截图:
UIGraphicsBeginImageContextWithOptions(UIScreen.mainScreen().bounds.size, false, 0);
self.view.drawViewHierarchyInRect(view.bounds, afterScreenUpdates: true)
var image:UIImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
我该如何截取屏幕的一部分,而不是像我在这里做的那样截取整个屏幕?