0

Interface Builderでは、タブバーは表示されますが、シミュレーターには表示されません。私はそれを再配置し、Interface Builderのものをいじってみましたが、それでも表示されません。どうしてこれなの?これがコーディングです

#import #import

@interface mapview:UIViewController {

 MKMapView *mapView; 


}


-(IBAction)setMap:(id)sender;

-(IBAction)pushBack;

-(IBAction)findmyass:(id)sender;








@end

#import "mapview.h"
#import "NewClass.h"


@implementation mapview




-(void)viewDidLoad {
[super viewDidLoad];

mapView = [[MKMapView alloc] initWithFrame:self.view.bounds];  
mapView.delegate=self;  

[self.view addSubview:mapView];  
[NSThread detachNewThreadSelector:@selector(displayMap) toTarget:self withObject:nil];  



[mapView setMapType:MKMapTypeStandard];
[mapView setZoomEnabled:YES];
[mapView setScrollEnabled:YES];

MKCoordinateRegion region = { {0.0, 0.0 }, {0.0, 0.0 } };
region.center.latitude = 39.956907;
region.center.longitude = -75.610229;
region.span.longitudeDelta = 0.01f;
region.span.latitudeDelta = 0.01f;
[mapView setRegion:region animated:YES];


NewClass *ann = [[NewClass alloc] init];
ann.title = @"Vigil Location of Chester County ";
ann.subtitle = @"8 S. Wayne St. West Chester, PA 19382";
ann.coordinate = region.center;
[mapView addAnnotation:ann];

-(void)displayMap {  
MKCoordinateRegion region;  
MKCoordinateSpan span;  
span.latitudeDelta=0.2;  
span.longitudeDelta=0.2;  

CLLocationCoordinate2D location;  
location.latitude = -35;  
location.longitude = 146.2381;  
region.span=span;  
region.center=location;  

[mapView setRegion:region animated:TRUE];  
[mapView regionThatFits:region];  
}  

- (void)dealloc {  
[mapView release];  
[super dealloc];  
}  




/*
// Implement viewDidLoad to do additional setup after loading the view, typically from a        
- (void)viewDidLoad {
[super viewDidLoad];
}
*/

/*
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:    (UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
*/

- (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];

// Release any cached data, images, etc that aren't in use.
 }

 - (void)viewDidUnload {
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
 }






-(IBAction)pushBack {

[self dismissModalViewControllerAnimated:YES];
 }

 -(IBAction)findmyass:(id)sender {

mapView.showsUserLocation = YES;

 } 

 @end
4

1 に答える 1

0

ビュー全体(self.view.bounds)と同じフレームでmapViewを初期化しているため、mapViewがタブバーを覆っているのではないかと思います。

それが問題なら、試してみてください

CGRect frame = self.view.bounds;
frame.size.height = frame.size.height - 40;
mapView = [[MKMapView alloc] initWithFrame:frame]; 

それ以外の

mapView = [[MKMapView alloc] initWithFrame:self.view.bounds];  

それがあなたの問題であるかどうかを教えてくれるはずです。その場合、ハードコードされた「40」ではなく、おそらくタブバーへの参照を取得し、その高さを差し引く必要があります。

于 2012-10-30T19:13:01.937 に答える