У меня есть файл с именем 'LoginViewController', который должен выполнить действие из файла 'RootViewController.m'.Я сделал NSLog, и он функционирует, но сам скрипт не работает.
Я также удостоверился в #import "RootViewController.h"
в моем LoginViewController.
LoginViewController
RootViewController *test = [[RootViewController alloc] init];
[NSThread detachNewThreadSelector:@selector(updateAlbumsAfterLogin) toTarget:test withObject:nil];
RootViewController
- (void)updateAlbumsAfterLogin {
NSLog(@"Updating albums after login!");
// Set up loading box and show it
UIImage *imageLoop = [UIImage imageNamed:@"loading_box.png"];
imagefour = [[UIImageView alloc] initWithImage:imageLoop];
imagefour.frame = CGRectMake(100, 80, 116, 116);
[self.view addSubview:imagefour];
// Set up loading text and show it
myLabel = [[UILabel alloc] initWithFrame:CGRectMake(97, 60, 130, 100)];
myLabel.text = @"Loading...";
myLabel.textColor = [UIColor whiteColor];
myLabel.textAlignment = UITextAlignmentCenter;
myLabel.backgroundColor = [UIColor clearColor];
myLabel.font = [UIFont fontWithName:@"Helvetica" size: 16.0];
myLabel.numberOfLines = 0;
//[myLabel sizeToFit];
[self.view addSubview:myLabel];
// Set up spinner and show it
myIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
myIndicator.center = CGPointMake(158, 155);
myIndicator.hidesWhenStopped = YES;
[self.view addSubview:myIndicator];
[myIndicator startAnimating];
[NSThread detachNewThreadSelector:@selector(updateAlbums) toTarget:self withObject:nil];
//myTimer = [NSTimer scheduledTimerWithTimeInterval:10.0 target:self selector: @selector(updateAlbums) userInfo: nil repeats: YES];
}
Заранее спасибо, Култон.
Если вам нужен любой другой код, не стесняйтесь спрашивать его!