0

I'm making a synchronize function that syncs local Core Data with the server. I want to make the synchronizations happen in the background without disrupting user interaction. When I receive the response (whether success or failure) the app should display a message somewhere on the screen to notify the user about the outcome.

UIAlertController is not a good choice because it will block user action.

Currently I'm using SVProgressHUD:

 __weak StampCollectiblesMainViewController *weakSelf = self;
if ([[AppDelegate sharedAppDelegate] hasInternetConnectionWarnIfNoConnection:YES]) {
    [_activityIndicator startAnimating];
    [Stamp API_getStampsOnCompletion:^(BOOL success, NSError *error) {
        if (error) {
            [_activityIndicator stopAnimating];
            [SVProgressHUD setDefaultMaskType:SVProgressHUDMaskTypeClear];
            [SVProgressHUD setAnimationDuration:0.5];
            [SVProgressHUD showErrorWithStatus:@"error syncronize with server"];
        }
        else {
            [_activityIndicator stopAnimating];
            [featuredImageView setImageWithURL:[NSURL URLWithString:[Stamp featuredStamp].coverImage] usingActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
            [yearDropDownList setValues:[Stamp yearsDropDownValues]];
            [yearDropDownList selectRow:0 animated:NO];
            [weakSelf yearDropDownListSelected];
            [SVProgressHUD dismiss];
        }
    }];
}

Is there a modification I can make so the user can still interact with the app? I just want to show the message without taking up too much space. Any help is much appreciated. Thanks.

Eric Aya
  • 69,473
  • 35
  • 181
  • 253
Lê Khánh Vinh
  • 2,591
  • 5
  • 31
  • 77

2 Answers2

3

Looks like the easiest thing will be to use SVProgressHUDMaskTypeNone.

Also check out this issue.

Aaron Brager
  • 65,323
  • 19
  • 161
  • 287
Stepan Generalov
  • 489
  • 4
  • 10
0

Sorry but you gonna have to build your own custom view. In fact it's not that difficult. What I would do is simply add a small view on the top of the screen with your custom message and a close button (to allow user to hide quickly the message). This is usually done by adding this new view to the current window, so that it will be on the top of every view and won't block the UI (except the part hidden by that view :) )

RomOne
  • 2,065
  • 17
  • 29