Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

iphone - Adding UIImageView to UIScrollView in background Thread, wont show up until all are added -


i have scrollview add uibuttons , uiactivityindicators in main thread. perform [nsthread detachselectorinbackground:@selector(getimages) totarget:self withobject:nil];

getimages downloads images , add them uiimageviews , adds uiimageviews scrollview, wont show until method getimages done. there way scrollview redraw or refresh or that?

and if scroll scrollview (with fingers..) during getimages method, uiimageviews has been added shows up.

- (void) getimages {     nsautoreleasepool *pool = [[nsautoreleasepool alloc] init];     int x=5;     int y=0;     nsdata *imgdata;     uiimage *img;     uiimageview *imgview;     (nsdictionary *tmp in thumbs) {    imgdata = [[nsdata alloc] initwithcontentsofurl:[nsurl urlwithstring:[functions urlforfile:[tmp objectforkey:@"img"]]]];   if ([imgdata length] > 0) {     img = [[uiimage alloc] initwithdata:imgdata];     imgview = [[uiimageview alloc] initwithframe:cgrectmake(x, y + (133-img.size.height)/2, 100, img.size.height)];      imgview.image = img;     [imgview setalpha:0.0];     [[self.scrollview viewwithtag:1500000*[[tmp objectforkey:@"id"] intvalue]] setalpha:1.0];     [self.scrollview addsubview:imgview];      [uiview beginanimations:nil context:null];     [uiview setanimationbeginsfromcurrentstate:yes];     [uiview setanimationduration:2.0];     [[self.scrollview viewwithtag:1500000*[[tmp objectforkey:@"id"] intvalue]] setalpha:0.0];     [imgview setalpha:1.0];     [uiview commitanimations];     [[self.scrollview viewwithtag:1500000*[[tmp objectforkey:@"id"] intvalue]] removefromsuperview];            [imgview release];     [img release];     [imgdata release];      x+=105;     if (x > 300) {       x=5;       y+=138;     }   } } [pool release]; [appdelegate.loadingview sethidden:yes]; } 

changing ui in background not thread-safe! downloading in background not displaying. show image 1 one can try run performselectoronmainthread:@selector() withobject:nil waituntildone:yes example self.scrollview addsubview:.

but again, ui should use mainthread (e.g. animations)


Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -