I have an ipad app is written in xcode 5.x and I have
1 controller with a tableview and UIProgressView 1 class that does syncronious download (NSObject class)
1.) The controller calls the donwload function from the download class 2.) The function should update the progress bar
As far as my research goes that should be done by using app delegate to access the Controller from the NSObject class
The problem is that the progressbar does not update at all if I nslog the values they are correct 0.xxxx (float value)
My code so far:
MyAppDelegate.h
@property (strong, nonatomic) UIViewController * activeController;
MyTableViewController.m
- (void)viewDidLoad
{
[super viewDidLoad];
MyAppDelegate *appDelegate = (MyAppDelegate*)[[UIApplication sharedApplication] delegate];
appDelegate.activeController = self;
}
MyDownloadClass.m
- (NSMutableArray *)uvoz:(NSString *)ident{
@autoreleasepool {
NSUInteger max = [jsonArray count], i = 0;
MyAppDelegate *appDelegate = (MyAppDelegate*)[[UIApplication sharedApplication] delegate];
MyTableViewController *topView = (MyTableViewController *)appDelegate.activeController;
topView.uiProgress.progress = i;
for (NSDictionary *line in jsonArray) {
i++;
[topView.uiProgress setProgress:(((float)i - 1 ) / (max-1)) animated:YES];
}
}
}