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.

objective c - Play Video immediately when UIView is loaded -


howdy! i'm writing ipad app, , need able play video when uiview loads. however, getting bad_exc_access if try message mpmovieplayercontroller anywhere after initialize it. removed mpmediaplayercontroller *.h file, declared entirely in implementation file, , i'm getting message @ bottom below code. there no issues in build , analyze memory leaks (or issues, matter), , cannot find posts this. here's code:

    - (id)initwithnibname:(nsstring *)nibnameornil bundle:(nsbundle *)nibbundleornil {     self = [super initwithnibname:nibnameornil bundle:nibbundleornil];     if (self) {      }   nsstring *url = [[nsbundle mainbundle] pathforresource:@"p0600c0100cmpintro" oftype:@"m4v"];  mpmovieplayercontroller *movie = [[mpmovieplayercontroller alloc] initwithcontenturl:[nsurl fileurlwithpath:url]];  nslog(@"%@", movie);  movie.view.frame = cgrectmake(5, 0, 1035, 768);  movie.view.contentmode = uiviewcontentmodescaletofill;  [[movie view] setcenter:cgpointmake(movie.view.center.x-10, movie.view.center.y)];  [movie setcontrolstyle:mpmoviecontrolstylenone];     [movie setshouldautoplay:yes];  [[self view] addsubview:[movie view]];      return self;     } 

the nslog of "movie" gives "mpmovieplayercontroller: 0x1b77f0", error message upon crash "* -[mpmovieplayercontroller playbackstate]: message sent deallocated instance 0x1473a0". help?

according documentation looks frame of movie view needs match view of parent. try moving code out of initwithnibname:bundle: viewdidload:

- (void)viewdidload {      [super viewdidload];       uiview *moviecontainer = [[uiview alloc] initwithframe:cgrectmake(5, 0, 300, 400)];      //do other positioning of view       nsstring *path = [[nsbundle mainbundle] pathforresource:@"p0600c0100cmpintro" oftype:@"m4v"];       nsurl *url = [nsurl fileurlwithpath:path];      mpmovieplayercontroller *movie = [[mpmovieplayercontroller alloc] initwithcontenturl:url];      movie.view.frame = moviecontainer.bounds;  //make sure bounds of parent view      movie.scalingmode = mpmoviescalingmodefill;      movie.controlstyle = mpmoviecontrolstylenone;      movie.shouldautoplay = yes;       [moviecontainer addsubview:movie.view];      [self.view addsubview:moviecontainer];       [moviecontainer release]; } 

one last suggestion keep reference of movie can dealloc once view controller gets deallocated


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 -