0

I am checking internet connection availability in application delegate. But instead of displaying alert view for no internet connection, i need to load a view or addsubview to the application. Also i need to remove that view in internet connection available.

[window addSubView:errorconncting.view];

[errorconnecting removeFromsuperView];

This one is not working.

Thank You.

EmptyStack
  • 51,274
  • 23
  • 147
  • 178
Sameera Chathuranga
  • 3,638
  • 3
  • 27
  • 48

3 Answers3

0

It is possible that you connected the main view to the window in the Interface Builder, this will override your own settings. The best approach would be to have a default view in the NIB, then depending on the internet connection add the appropriate view to this base / default view.

grundprinzip
  • 2,471
  • 1
  • 20
  • 34
0

If Internet connection is not there

[self.view removeFromSuperView];
errorconnectingClassObject errorconncting = [errorconnectingClassObject alloc]initWithNibName:@"" options:nil];
[window addSubView: errorconncting.view];

Naveen Thunga
  • 3,675
  • 2
  • 24
  • 31
0

instead of

[errorconnecting removeFromsuperView];

it should be

[errorconnecting.view removeFromsuperView];

You can add as many subviews to window. So whenever you have to show a new view, first try adding it in window as subview, see if it works.

Ved
  • 612
  • 6
  • 10