문제

iPhone MapView (Google 코드에 따라)를 사용하는 응용 프로그램을 만들려고합니다. 전체 UI를 필기하지 않고이 항목을 내 응용 프로그램에 통합하는 방법, 즉 IB를 전혀 사용하지 않는 방법을 알 수 없습니다.

인터페이스 빌더를 사용하여 모든 메뉴 등을 생성하지만 MapView를 추가하려면 어떻게해야합니까? IB 구성 요소로 만들려면 MapView를 편집해야합니까?

감사!

편집하다:

@pgb

여기 내 코드가 있습니다. 여전히 빈 uiview 만 표시하고 IB 측의 모든 것을 연결했습니다.

//
//  NewTestViewController.h
//  NewTest
//

#import <UIKit/UIKit.h>

@interface NewTestViewController : UIViewController {
 UIView* mapPlaceholder;

}
@property (nonatomic, retain) IBOutlet UIView* mapPlaceholder;
@end

//
//  NewTestViewController.m
//  NewTest
//

#import "NewTestViewController.h"
#import "MapView.h"

@implementation NewTestViewController
@synthesize mapPlaceholder;



// The designated initializer. Override to perform setup that is required before the view is loaded.
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
    if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) {
        MapView *mapView = [[[MapView alloc] initWithFrame:
        [[UIScreen mainScreen] applicationFrame]] autorelease];
  [mapPlaceholder addSubview:mapView];
    }
    return self;
}


/*
// Implement loadView to create a view hierarchy programmatically, without using a nib.
- (void)loadView {
}
*/


/*
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (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;
}


- (void)dealloc {
 [mapPlaceholder.subviews release];
    [super dealloc];
}

@end

Nevermind는 Thangs PBG를 알아 냈습니다

도움이 되었습니까?

해결책

아마도 IB에서 전체 인터페이스를 생성하고 빈을 추가 할 수 있습니다. UIView 자리 표시자는보기로서 사용합니다 addSubview: 추가하려면 MapView 뷰 계층 구조에 대한 인스턴스.

자리 표시 자 견해는 IBOutlet, 그러면 추가 할 수 있습니다 MapView 당신의 UIViewController 사례.

다른 팁

IB에서는 uiview를 추가 한 다음 View 유형을 사용자 정의 UIView로 변경할 수 있습니다. MkMapView와 마찬가지로 MapView 하위 클래스 UIView를 가정합니다 ...

iPhone MapView (Google 코드에 따라)를 사용하는 응용 프로그램을 만들려고합니다.

Mapkit을 사용하지 않는 이유는 무엇입니까? 분명히 IB는 라이브러리에 mkmapview와 함께 제공됩니다.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top