MBProgressHUD 完成图像 Swift
MBProgressHUD Completed with image Swift
经过一些教程和调试后,我设法让 MBProgressHUD(带有 cocoapods)在我的应用程序上运行(在 Swift 中)。现在,当我想要的进度完成时,我正在尝试执行 MBProgressHUD。所以现在,我想用一些文本显示一个复选标记。问题是我不知道怎么把图片(图标)放在文字前面。
我的代码有效(没有复选标记):
self.spinningCompleted = MBProgressHUD.showHUDAddedTo(self.view, animated: true)
self.spinningCompleted.customView = ???????????????????????
self.spinningCompleted.mode = MBProgressHUDMode.CustomView
self.spinningCompleted.labelText = "Completed!"
self.spinningCompleted.userInteractionEnabled = false
self.spinningCompleted.hide(true, afterDelay: 2)
我想要但在 objective-C:
- (void)connectionDidFinishLoading:(NSURLConnection *)connection {
HUD.customView = [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"37x-Checkmark.png"]] autorelease];
HUD.mode = MBProgressHUDModeCustomView;
[HUD hide:YES afterDelay:2];
}
提前致谢!
在Swift中:
self.spinningCompleted.customView = UIImageView(image: UIImage(named: "37x-Checkmark.png"))
经过一些教程和调试后,我设法让 MBProgressHUD(带有 cocoapods)在我的应用程序上运行(在 Swift 中)。现在,当我想要的进度完成时,我正在尝试执行 MBProgressHUD。所以现在,我想用一些文本显示一个复选标记。问题是我不知道怎么把图片(图标)放在文字前面。
我的代码有效(没有复选标记):
self.spinningCompleted = MBProgressHUD.showHUDAddedTo(self.view, animated: true)
self.spinningCompleted.customView = ???????????????????????
self.spinningCompleted.mode = MBProgressHUDMode.CustomView
self.spinningCompleted.labelText = "Completed!"
self.spinningCompleted.userInteractionEnabled = false
self.spinningCompleted.hide(true, afterDelay: 2)
我想要但在 objective-C:
- (void)connectionDidFinishLoading:(NSURLConnection *)connection {
HUD.customView = [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"37x-Checkmark.png"]] autorelease];
HUD.mode = MBProgressHUDModeCustomView;
[HUD hide:YES afterDelay:2];
}
提前致谢!
在Swift中:
self.spinningCompleted.customView = UIImageView(image: UIImage(named: "37x-Checkmark.png"))