手順は次のようになります。
は、緯度と長い取得し、2つのラベル、self.label1とself.label2
transparentColorの背景と空のビューを作成するには、それらを設定します。
はaddSubviewを使用してラベルを追加しますステップ2.
で作成したビューにステップ2.
セットcameraOverlayViewのビューにごピッカーを提示します。
コードで
:
はあなたの.hに定義します。CLLocationManager *locationManager
と実装デリゲート:<CLLocationManagerDelegate>
- (void)viewDidLoad {
[super viewDidLoad];
locationManager = [[CLLocationManager alloc] init];
locationManager.delegate = self;
locationManager.distanceFilter = kCLDistanceFilterNone; //How often do you want to update your location, this sets every small change should fire an update.
locationManager.desiredAccuracy = kCLLocationAccuracyBest;
[locationManager startUpdatingLocation];
}
を次に実装します。
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation {
NSString *lat = [NSString stringWithFormat:@"%d", newLocation.coordinate.latitude];
self.label1.text = lat;
NSString *long = [NSString stringWithFormat:@"%d", newLocation.coordinate.longitude];
self.label2.text = long;
}
を次に、あなたを提示したい場所コード付きカメラ:
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
emptyView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)]; //This frame will make it fullscreen...
emptyView.backgroundColor = [UIColor transparentColor];
[emptyView setAlpha:1.0]; //I think it is not necessary, but it wont hurt to add this line.
self.label1.frame = CGRectMake(100, 100, self.label1.frame.size.width, self.label1.frame.size.height); //Here you can specify the position in this case 100x 100y of your label1 preserving the width and height.
[emptyView addSubview:self.label1];
//Repeat for self.label2
self.picker.cameraOverlayView = emptyView; //Which by the way is not empty any more..
[emptyView release];
[self presentModalViewController:self.picker animated:YES];
[self.picker release];
私はこれをテストしていないので、十分に明確で、欠けているものはないと願っています。
私はあなたの答えを理解しているか分かりません。ユーザーの場所を知っているので、ユーザーが別の場所を探していることを示す必要があります。たとえば、私はニューヨークにいて、自由の女神像がどこにあるのか知りたいと思っています。私はその緯度と経度を知っていなければなりません。 – VansFannel
ああ、私はあなたの現在の位置をオーバーレイしたいと思った..あなたが求めるものは、画像認識ソフトウェアの多くです。 –