multithreading - Managing a view while another process runs on iPhone -
I have a problem here, I allow the user to upload some video to the server, but I do have some
If someone tries to make some code then I am using difficulties in managing a problem, to clarify my progress, I know why the problem is happening and I find a way around it
Something looks like this (in a UIViewController
- (Zero) UploadMonini {UIActivityView Predictor = New ... [self.view addSubview: indicator] [Uploader UploadMemi: data]}
This code does not work, the uploader will lock the controller And the indicator will not allow the timer to come on screen, I was waiting a few seconds before calling on the uploader's work but I took another approach.
Start a new thread for the Viewer Uploader Had to do and had a protocol in which the uploader was As soon as Junk uploads, UIViewController (or some representative) indicates its progress, and when it ends uploading some kind of
- (zero) uploadsMohini {UIActivityView pointer = new. .. [self.view addSubview: pointer] NSThread * thread = ... [thread starts]}
Representative method looks something like this
#pragma mark UploadProgressDelegate - (zero) didStartUploading {progressLabel = [[UILabel alloc] initWithFrame: CGRectMake (93, 240, 116, 32)]; Ind = [[UIActivity Indicator Merged Alloc] InitvityViewivity Indicator Style: UIActivindIndicatorViewStyleWitLarge]; Ind.center = self.view.center; [Progress Table Settextcore: [UIColor blackcolor]]; [Progress label set text: @ "test"]; [Self.view addSubview: progress label]; [Self.view addSubview: ind]; [Inducted initials]; [Self.view Laosvivio Toufrrant: Progress Label]; [Indoor Setheads Head: TRUE]; [Self.view setUserInteractionEnabled: FALSE]; } - (Zero) Progress Update: (NSString *) Progress {[Progress Lbill Set: Progress]; } - (zero) doneUnduploading; [[Progress pending deletion project]; [Indstasy stop animation]; [INDEMS removerFromSuperview]; [Progress label release]; [Ind release]; [Self.view setUserInteractionEnabled: TRUE]; }
It shows great and indicative and everything works, then I decided to look at progress by adding the user to UILBL (shown in the code above), but the solution for this is to work Do not, the label is not displayed and there is no update ...
I was thinking that someone has faced this situation and has come up with a solution for it? Or if you can see why the label is not showing ... maybe
thanks
UIKit thread is not secure-if you are updating a UI element, you need to sync back to the main thread or all bets are closed.
Comments
Post a Comment