iOs show checkmark when finished loading - iphone

I have an implanted Facebook in my app. When it is posting something on Facebook it is displaying a Activity Indicator wich works as it should but I want to show a checkmark when it is finished with posting. I am not sure how to do this. This is the code when it is finished with loading
- (void)request:(FBRequest *)request didReceiveResponse:(NSURLResponse *)response {
//Stop the spinner
[ActivityView removeView];
}

Look at - https://github.com/jdg/MBProgressHUD
It is very easy to use and has many examples.

If you're using a XIB, place the checkmark in an imageView and then position it where you want in your view. Wire it to an IBOutlet so you can access it from your view controller. Set the imageView's property to be hidden initially.
In your didReceiveResponseMethod, update the imageView's property to:
imageView.hidden = NO;

Related

UIAlertView Dynamically in iPhone App

I want to display dynamic UIAlertView and Indicator within it when data is loading from web-service.
Also I don't want any button on UIAlertView. And it will be stopped automatically when data will be loaded successfully.
How can I implement it.?
Just declar UIAlertView and then your activity indicator, make indicator a sub view to alert view and then when your data has been loaded from web service dismiss with this instance method
– dismissWithClickedButtonIndex:animated:
If you are using WebView then write startAnimating ActivityIndicator in ViewDidLoad and this delegate method will call by itself when your data will be loaded
- (void)webViewDidFinishLoad:(UIWebView *)webView
{
//[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];
[ActivityIndicator stopAnimating];
}
Hope it helps.Thanks :)
Then use MBProgress HUD or SVprogress HUD
https://github.com/jdg/MBProgressHUD

WebView Activity Indicator won't stop spinning - iPhone Objective-C

I would like it to stop spinning once the website finishes loading...
The code I have it:
in my .h
IBOutlet UIActivityIndicatorView *activityIndicator;
in my .m
- (void)webViewDidStartLoad:(UIWebView *)webView {
[activityIndicator startAnimating];
}
- (void)webViewDidFinishLoad:(UIWebView *)webView {
[activityIndicator stopAnimating];
self.view = webView;
}
I then hooked it up to files owner in the nib. It spins, but doesn't stop! Any suggestions? Thanks!
Does the web view ever actually finish loading? Set a breakpoint and see if you ever even hit that method.
And, for completeness...you do have the delegate of the webview set to your view controller, correct (I assume you do, as it starts animating, but you never know)?
There are two ways you can set the delegate of the webview. If you have it in your nib, control click on the webview and drag from the delegate property to File's Owner. Or, in viewDidLoad, just say _webView.delegate = self;
UPDATE: After our conversation, and in regards to the comments below, I just want to add this for completeness, and for anyone else who sees this in the future with the same issue. The reason your webView was getting huge after it finished loading was because you were assigning it to the view property of your view controller when you said self.view = webview. No need for that. Take that out, and you'll be fine.
Make sure you have the correct toggle settings on the actual UIActivityIndicatorView object in Interface Builder and make sure it's linked correctly. I believe you want "hides when stopped".
Also make sure you have the WebView Delegate implemented.
should work the way you implemented it.
Add following code
- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error {
[loadIndicator stopAnimating];
}
Maybe your UIWebView doesn't finish loading properly.

Activity indicator in UITableView in iphone app

In my iphone app I have a table view. In that onclick of each row it will download some data. During that download process I need to animate an activity indicator. How to add an activity indicator in table view?
First, you do not need to add activity indicator in table view. You just add it in that view and then set its hidden property. When the user clicks on a row, set its hidden property to NO.
One more thing, move your table to send to back from layout->send to back
and the indicator to send to front layout->sent to front.
Just add an UIActivityIndicatorView to your view say activity Assign it the frame and style you want.
Then all you need to do is that put the below code above your download code.
[NSThread detachNewThreadSelector:#selector(myMethod:) toTarget:self withObject:nil];
and you need to declare myMethod as
-(void)myMethod:(id)data
{
[activity startAnimating];
[activity setHidden:NO];
}
Whenever your download finishes just put
[activity stopAnimating];
[activity setHidden:YES];
Hope this helps you.

Hiding iAds programmatically in iPhone

Currently I am showing iAds in my app.They are working fine.Now, I want to hide the iAds based on some conditions in code.
What I am using is
ADBannerView *bannr= (ADBannerView *)[self.view viewWithTag:1];
bannr.hidden = YES;
bannr.userInteractionEnabled = NO;
iAds get hidden.But when i press the area where iAd is supposed to be.Advertisement details window popup
With my iAds I transition them on or off screen after the relevant callbacks are received by it's delegate.
It works for me fine.
Hope this helps
Good Luck,
Since ADBannerView is a subclass of UIView you should be able to remove it using removeFromSuperview.
[bannr removeFromSuperview];
It doesn't explain why you still can interact with the hidden view but you should be able to keep going.
Update
Alternative solution: If the ad gets triggered even when hidden you can perhaps try this in the delegate:
- (BOOL)bannerViewActionShouldBegin:(ADBannerView *)banner willLeaveApplication:(BOOL)willLeave {
if (banner.isHidden) {
return NO;
}
// Business as usual
}

How to add a HUD? (iOS)

I am trying to have some controls appear when you push a button and have it disappear when you press a different button. Right now the HUD is comprised of an image view, and some custom buttons in a UIView called "credits". I've managed to have it disappear using:
[credits removeFromSuperview];
How do I have it reappear?
If it's just a UIImageView, you should...
[self.view addSubview:credits];
... assuming you've not released it already. On a side note, there is a really good HUD for iOS here: http://github.com/matej/MBProgressHUD
I believe you can just set the view to be hidden
[self.view setHidden:YES];
While it's hidden, you can also update the view and then show again
[self.view setHidden:NO];
You'd better set their hidden property to whether YES or NO
This method will toggle the UIView credits hidden property
- (void) toggleCredits {
[credits setHidden:![credits isHidden]];
}