2012-10-30 3 views
0

인터페이스 작성기에서 내 탭 표시 줄이 나타나지만 시뮬레이터에 나타나지 않습니다. 필자는 그것의 위치를 ​​재조정하고 인터페이스 빌더에있는 것들을 어지럽 혀서 시도해 보았지만 아직도 나타나지 않았다. 왜 이런거야? 다음은 코딩Tab Bar가 시뮬레이터에 나타나지 않습니다.

# import를 # import를하다

@interface의지도보기 :의 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 

답변

0

전체보기와 동일한 프레임 (self.view.bounds). 그 문제가 있다면

,

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"대신 높이를 빼야합니다.

+0

완벽하게 고마워했습니다. 사용자 위치를 찾는 것이 지금은 작동하지 않습니다. 이것에 대한 조언? –

+0

다행이었습니다. 답변을 수락하려면 '확인'을 클릭하십시오. – Hap

관련 문제