这里有没有人试图使用MBProgressHUD自定义动画.有一个自定义视图选项,但它只适用于您已完成任务的静态显示.我正在寻找一种方法来替换旋转的辐条,例如旋转沙滩球或我选择的其他图形.我已经通过他的源码中的drawRect方法阅读了,并且我不熟悉绘图以查看我可以用来实现我的目标的任何mod.我希望有人在这里做过并且会分享,或者有人能指出我正确的方向来帮助我自己做.谢谢.
我从xCode项目中收到以下警告.我该如何摆脱它们?
注意:我使用MBProgessHud和FMDB
Warning: no rule to process file '$(PROJECT_DIR)/MBProgressHUD.h' of type sourcecode.c.h for architecture i386
Warning: no rule to process file '$(PROJECT_DIR)/SampleProj/../FMDatabase.h' of type sourcecode.c.h for architecture i386
Run Code Online (Sandbox Code Playgroud) 在这里说使用MBProgressHUD很容易.但我做不到.
这是我的代码:
- (IBAction)save{
HUD = [[MBProgressHUD alloc] initWithView:self.navigationController.view];
[self.navigationController.view addSubview:HUD];
HUD.delegate = self;
[HUD show:YES];
NSString *title = [page stringByEvaluatingJavaScriptFromString:@"document.title"];
SavePageAs *savePage = [[SavePageAs alloc] initWithUrl:self.site directory:title];
[savePage save];
[HUD hide:YES];
}
Run Code Online (Sandbox Code Playgroud)
savePage save方法运行期间未显示进度指示器,但在页面完全保存后显示(指示器显示不到1秒).
我也尝试过这种方式:
- (IBAction)save {
HUD = [[MBProgressHUD alloc] initWithView:self.navigationController.view];
[self.navigationController.view addSubview:HUD];
HUD.delegate = self;
HUD.labelText = @"Saving...";
[HUD showWhileExecuting:@selector(performFetchOnMainThread) onTarget:self withObject:nil animated:YES];
}
- (void) savingPage{
NSString *title = [page stringByEvaluatingJavaScriptFromString:@"document.title"];
SavePageAs *savePage = [[SavePageAs alloc] initWithUrl:self.site directory:title];
[savePage save];
}
-(void) …Run Code Online (Sandbox Code Playgroud) 我MBProgressHUD用来显示HUD,但没有按预期显示.
步骤:用户选择一个单元格tableView.解析一些数据然后UIAlertView向用户显示warning().询问用户是否要与所选(单元)用户一起创建新游戏.取消/开始游戏按钮.
该UIAlertView委托方法如下:
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
NSLog(@"button %i",buttonIndex);
if (buttonIndex == 0) {
// Cancel button pressed
self.gameNewOpponentuser = nil;
} else {
// Start Game button pressed
[MESGameModel createNewGameWithUser:[PFUser currentUser] against:self.gameNewOpponentuser];
}
}
Run Code Online (Sandbox Code Playgroud)
如果用户选择"开始游戏",GameModel则运行该方法.游戏模型(NSObject子类)方法如下:
+(void)createNewGameWithUser:(PFUser *)user1 against:(PFUser *)user2 {
// First we put a HUD up for the user on the window
MBProgressHUD *HUD = [[MBProgressHUD alloc] initWithWindow:[UIApplication …Run Code Online (Sandbox Code Playgroud) 当进入前台时,ProgressIndicator(MTMProgressHub)不会出现
hud = new MTMBProgressHUD (View);
View.BringSubviewToFront (hud);
View.AddSubview (hud);
hud.Show (true);
Run Code Online (Sandbox Code Playgroud)
请找到下面的图片
如图中所示,进度指示器位于按钮的背面(注册登录,请联系我们)。
public LoginViewController(){
hud = new MTMBProgressHUD (View);
View.BringSubviewToFront (hud);
View.AddSubview (hud);
hud.Show (true);
Run Code Online (Sandbox Code Playgroud)
}
无法将其推到前面。
我正在尝试将取消按钮与MBProgressView一起使用。我收到错误消息“无法将类型'()'的值转换为预期的参数类型'选择器'”
hud.button.addTarget(hud.progressObject, action: cancelButton(), for: .touchUpInside)
Run Code Online (Sandbox Code Playgroud)
我也尝试这样做:
hud.button.addTarget(hud.progressObject, action: #selector(cancelButton), for: .touchUpInside)
Run Code Online (Sandbox Code Playgroud)
我得到了错误“ #selector的参数不能引用本地函数'cancelButton()'”。
谁能向我解释我在做什么错?
cancelButton应该在viewDidLoad中,或者至少我需要找到一种方法来访问viewDidload内的内容,因为我需要使用hud和snapshot.progress来取消下载:
override func viewDidLoad() {
super.viewDidLoad()
let appdelegate = UIApplication.shared.delegate as! AppDelegate
appdelegate.orintation = UIInterfaceOrientationMask.allButUpsideDown
if book?.bookPath != book?.bookPath {
print("HERE \(book?.bookPath)")
loadReader(filePaht: (book?.bookPath)!)
} else {
let documentsPath = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0]
let strName = book?.id
let filePath = "\(documentsPath)/"+strName!+".pdf"
let fileManager = FileManager.default
if fileManager.fileExists(atPath: filePath) {
loadReader(filePaht: filePath)
return;
}
print("DOWNLOAD #1")
let reference = FIRStorage.storage().reference(forURL: (self.book?.bookURL)!)
let downloadTask = reference.data(withMaxSize: 50 …Run Code Online (Sandbox Code Playgroud) ios ×3
objective-c ×3
iphone ×2
c# ×1
fmdb ×1
ios5 ×1
selector ×1
swift ×1
xamarin ×1
xamarin.ios ×1