Add UIActivityIndicatorView into UIBarButton

If you’re trying to show the activity wheel in a navigation bar button (e.g. you might have a refresh button on your navbar) – you can create a new UIBarButtonItem with a custom view being the UIActivityIndicatorView: Objective-C uiBusy = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite]; uiBusy.hidesWhenStopped = YES; [uiBusy startAnimating]; [self.navigationItem.rightBarButtonItem initWithCustomView:uiBusy]; Swift let uiBusy = UIActivityIndicatorView(activityIndicatorStyle: … Read more

Show activity indicator in SDWebImage

This fork has support for this functionality. Take a look at the diff. But, in general, you can do it rather easily without using that fork: __block UIActivityIndicatorView *activityIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:activityStyle]; activityIndicator.center = imageView.center; activityIndicator.hidesWhenStopped = YES; [imageView setImageWithURL:[NSURL URLWithString:@”http://www.domain.com/path/to/image.jpg”] placeholderImage:[UIImage imageNamed:@”placeholder.png”] success:^(UIImage *image) { [activityIndicator removeFromSuperview]; } failure:^(NSError *error) { [activityIndicator removeFromSuperview]; … Read more

UIActivityIndicatorView stops animating in UITableViewCell

I think I can shed some light into when and how the spinners stop spinning in cells. I’ve subclassed UIActivityIndicatorView with my own class overloading the startAnimating and stopAnimating functions and put breakpoints in them. I’ve made a simple cell with only a spinner on it of my class. I’ve set the spinner’s Animating property … Read more

How to show activity indicator while tableView loads?

Just try this: var indicator = UIActivityIndicatorView() func activityIndicator() { indicator = UIActivityIndicatorView(frame: CGRectMake(0, 0, 40, 40)) indicator.activityIndicatorViewStyle = UIActivityIndicatorViewStyle.Gray indicator.center = self.view.center self.view.addSubview(indicator) } And where you want to start animating indicator.startAnimating() indicator.backgroundColor = UIColor.whiteColor() For stop: indicator.stopAnimating() indicator.hidesWhenStopped = true Note: Avoid the calling of start and stop at the same time. Just … Read more

How to set an UIActivityIndicatorView when loading a UITableViewCell

You can add UIActivityIndicatorView as cell’s accessoryView. – (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { UIActivityIndicatorView *spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray]; spinner.frame = CGRectMake(0, 0, 24, 24); UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath]; cell.accessoryView = spinner; [spinner startAnimating]; [spinner release]; }

Dismiss UIAlertView after 5 Seconds Swift

A solution to dismiss an alert automatically in Swift 3 and Swift 4 (Inspired by part of these answers: [1], [2], [3]): // the alert view let alert = UIAlertController(title: “”, message: “alert disappears after 5 seconds”, preferredStyle: .alert) self.present(alert, animated: true, completion: nil) // change to desired number of seconds (in this case 5 … Read more

Can I change the size of UIActivityIndicator?

The following will create an activity indicator 15px wide: #import <QuartzCore/QuartzCore.h> … UIActivityIndicatorView *activityIndicator = [[[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray] autorelease]; activityIndicator.transform = CGAffineTransformMakeScale(0.75, 0.75); [self addSubview:activityIndicator]; While I understand the sentiment of TechZen’s answer, I don’t think adjusting the size of a UIActivityIndicator by a relatively small amount is really a violation of Apple’s standardized interface … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)