0

I have a somewhat long server call sending a JSON object, and I have a UIAlertView for bad connection.

I want to add a loading screen while waiting for the server response though. I'm currently receiving either a success message or failure.

Is there a function I can put in to call a UIView just until the server comes back with a response?

I can copy any code in here if needed.

James Cockerham
  • 399
  • 1
  • 3
  • 13
  • If you're making an NSURLRequest with completion blocks, you can use a delegate or send a NSNotification to remove the activity indicator. – brandonscript Oct 01 '14 at 17:07

2 Answers2

0

Yes you can show the Loading Indicator View. check this MBProgressHUD What you need to do is while calling request you just need to show the loading view and as soon as you getting the response callback (success or failure) just hide the loading view. That's all.

You can Blocks as custom call back and NSURLSession. Follow This line

Community
  • 1
  • 1
Sanoj Kashyap
  • 5,020
  • 4
  • 49
  • 75
0

The most simple way and effective and used in most programs to implement the following steps : 1- Lock the screen; Javascript type 2- Style (CSS for LockOn and LockOff): show the cursor status. If LockOn, the cursor's status is "wait". If LockOff, the cursor's status is "Default" 3- OnclientClick to connect with the server and run java with CSS lockOn 4- div for lockoff after finishing the connection with the server 5- That's all

'1- First Step

<script type="text/javascript">
function skm_LockScreen(str)
           {
     var lock = document.getElementById('SecrrenLock');
     if (lock)
        lock.className = 'LockOn';
                       lock.innerHTML = str;
    }
   </script>

'2- Second step

<style type="text/css">
       .LockOff {
     display: none;
     visibility: hidden;
       cursor:default;
  }

  .LockOn {
     display: block;
     visibility: visible;

             cursor: wait;

  }    
   </style>

3- Third Step: ButtonX: Click the button to connect with the server or database

onclientclick="SecrrenLock('Write what you want:Please, Wait');"

4-Fourth Step: Disconnecting and screen back active

<div id="SecrrenLock" class="LockOff"></div>