'Object-C' 카테고리의 다른 글
valueForKey vs objectForKey (0) | 2010.10.22 |
---|---|
키보드 사라지게 하기 (0) | 2010.10.22 |
MoviePlayer (0) | 2010.10.09 |
MapView (0) | 2010.10.09 |
XML (0) | 2010.10.09 |
valueForKey vs objectForKey (0) | 2010.10.22 |
---|---|
키보드 사라지게 하기 (0) | 2010.10.22 |
MoviePlayer (0) | 2010.10.09 |
MapView (0) | 2010.10.09 |
XML (0) | 2010.10.09 |
- (IBAction)btnFilePress:(id)sender {
NSString *path = [[NSBundle mainBundle] pathForResource:@"Moviecountdownwithsound" ofType:@"mp4"];
if (path) {
MovieURL = [NSURL fileURLWithPath:path];
}
//MPMoviePlayerController *thePlayer = [[MPMoviePlayerController alloc] initWithContentURL:MovieURL]; //ver 3.x
MPMoviePlayerViewController *thePlayer = [[MPMoviePlayerViewController alloc] initWithContentURL:MovieURL];
//thePlayer.scalingMode = MPMovieScalingModeAspectFit; //ver 3.x
thePlayer.moviePlayer.scalingMode = MPMovieScalingModeAspectFit;
thePlayer.moviePlayer.shouldAutoplay = YES;
[thePlayer shouldAutorotateToInterfaceOrientation:YES];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(myMovieFinishedCallback:) name:MPMoviePlayerPlaybackDidFinishNotification object:thePlayer];
//[thePlayer play]; //ver 3.x
[self.navigationController presentModalViewController:thePlayer animated:NO];
}
- (void)myMovieFinishedCallback:(NSNotification *)aNotification {
MPMoviePlayerController *thePlayer = [aNotification object];
[[NSNotificationCenter defaultCenter] removeObserver:self name:MPMoviePlayerPlaybackDidFinishNotification object:thePlayer];
[thePlayer release];
}
- (IBAction)btnStreamPress:(id)sender {
NSString *path = @"http://movies.apple.com/media/us/iphone/2010/tours/apple-iphone4-design_video-us-20100607_r848-9cie.mov";
if (path) {
MovieURL = [NSURL URLWithString:path];
}
//MPMoviePlayerController *thePlayer = [[MPMoviePlayerController alloc] initWithContentURL:MovieURL]; //ver 3.x
MPMoviePlayerViewController *thePlayer = [[MPMoviePlayerViewController alloc] initWithContentURL:MovieURL];
//thePlayer.scalingMode = MPMovieScalingModeAspectFit; //ver 3.x
thePlayer.moviePlayer.scalingMode = MPMovieScalingModeAspectFit;
thePlayer.moviePlayer.shouldAutoplay = YES;
[thePlayer shouldAutorotateToInterfaceOrientation:YES];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(myMovieFinishedCallback:) name:MPMoviePlayerPlaybackDidFinishNotification object:thePlayer];
//[thePlayer play]; //ver 3.x
[self.navigationController presentModalViewController:thePlayer animated:NO];
}
키보드 사라지게 하기 (0) | 2010.10.22 |
---|---|
NSNotificationCenter (0) | 2010.10.10 |
MapView (0) | 2010.10.09 |
XML (0) | 2010.10.09 |
SQLITE (0) | 2010.10.08 |
UIViewController <MKMapViewDelegate, MKReverseGeocoderDelegate> {
...
}
- (void)viewDidLoad {
MKCoordinateRegion seoulRegion;
CLLocationCoordinate2D center;
center.latitude = 37.47783;
center.longitude = 127.044060;
MKCoordinateSpan span;
span.latitudeDelta = 0.005;
span.longitudeDelta = 0.005;
seoulRegion.center = center;
seoulRegion.span = span;
mapView.region = seoulRegion;
NSMutableArray *annotations = [[NSMutableArray alloc] init];
CLLocationCoordinate2D coord2d = {37.47783,127.044060};
MyAnnotation *anno = [[MyAnnotation alloc] initWithCoords:coord2d name:@"name1"];
anno.title = @"title1";
anno.subtitle = @"subtitle1";
[annotations addObject:anno];
[anno release];
CLLocationCoordinate2D coord2d1 = {37.480783,127.046060};
MyAnnotation *anno1 = [[MyAnnotation alloc] initWithCoords:coord2d1 name:@"name2"];
anno1.title = @"title2";
anno1.subtitle = @"subtitle2";
[annotations addObject:anno1];
[anno1 release];
[mapView addAnnotations:annotations];
[annotations release];
[super viewDidLoad];
}
-(MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>) annotation
{
MKPinAnnotationView *annoView = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:[annotation title]];
annoView.animatesDrop = YES;
UIButton *addButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
annoView.rightCalloutAccessoryView = addButton;
[annoView setCanShowCallout:YES];
[annoView setSelected:YES animated:YES];
[annoView release];
return annoView;
}
NSNotificationCenter (0) | 2010.10.10 |
---|---|
MoviePlayer (0) | 2010.10.09 |
XML (0) | 2010.10.09 |
SQLITE (0) | 2010.10.08 |
CoreData (0) | 2010.10.07 |