For some reason i can’t get activity indicator show up instantly. Maybe anyone could see why?
UIActivityIndicatorView *spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
spinner.center = self.view.center;
_active = spinner;
[self.view addSubview:spinner];
[spinner startAnimating];
@try {
[self connectToServerUsingStream:ip portNo:port];
NSString *text = @"test";
const uint8_t *str =
(uint8_t *) [text cStringUsingEncoding:NSASCIIStringEncoding];
[self writeToServer:str];
}
@catch (NSException * e) {
NSLog(@"Exception: %@", e);
}
The spinner only shows up then connection to server was made, before that it doesn’t show. Any ideas?
Use below updated code. I think it will work.