-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat: Show markers and info windows #71
- Search nearby marts from user's location - Set markers on map - Show info windows above each markers - Push to Mart detail info screen when tap info windows
- Loading branch information
Showing
4 changed files
with
145 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// | ||
// MarkerInfoWindowView.swift | ||
// MartHoliday | ||
// | ||
// Created by YOUTH2 on 15/06/2019. | ||
// Copyright © 2019 JINiOS. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
import NMapsMap | ||
|
||
class MarkerInfoWindowDataSource: NSObject, NMFOverlayImageDataSource { | ||
|
||
var branch: Branch? | ||
|
||
func view(with overlay: NMFOverlay) -> UIView { | ||
let markerInfoView = MarkerInfoWindowView(branch: self.branch) | ||
return markerInfoView.make() | ||
} | ||
|
||
} | ||
|
||
class MarkerInfoWindowView: UIView { | ||
|
||
@IBOutlet weak var contentView: UIView! | ||
@IBOutlet weak var branchTitle: UILabel! | ||
var branch: Branch? | ||
|
||
override init(frame: CGRect) { | ||
super.init(frame: frame) | ||
self.commonInit() | ||
} | ||
|
||
required init?(coder aDecoder: NSCoder) { | ||
super.init(coder: aDecoder) | ||
self.commonInit() | ||
} | ||
|
||
convenience init(branch: Branch?) { | ||
self.init(frame: CGRect(x: 100, y: 100, width: 100, height: 100)) | ||
self.branch = branch | ||
} | ||
|
||
private func commonInit() { | ||
Bundle.main.loadNibNamed("MarkerInfoWindowView", owner: self, options: nil) | ||
contentView.autoresizingMask = [.flexibleHeight, .flexibleWidth] | ||
} | ||
|
||
func make() -> UIView { | ||
self.branchTitle.text = self.branch?.displayName() | ||
self.contentView.layoutIfNeeded() | ||
return self.contentView | ||
} | ||
|
||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES"> | ||
<device id="retina6_1" orientation="portrait"> | ||
<adaptation id="fullscreen"/> | ||
</device> | ||
<dependencies> | ||
<deployment identifier="iOS"/> | ||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14490.49"/> | ||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> | ||
</dependencies> | ||
<customFonts key="customFonts"> | ||
<array key="NanumSquareRoundOTFR.otf"> | ||
<string>NanumSquareRoundOTFR</string> | ||
</array> | ||
</customFonts> | ||
<objects> | ||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="MarkerInfoWindowView" customModule="MartHoliday" customModuleProvider="target"> | ||
<connections> | ||
<outlet property="branchTitle" destination="gal-vv-uIe" id="49s-aC-qqS"/> | ||
<outlet property="contentView" destination="LNM-4r-Da5" id="4fT-Kd-cm4"/> | ||
</connections> | ||
</placeholder> | ||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/> | ||
<view contentMode="scaleToFill" id="iN0-l3-epB"> | ||
<rect key="frame" x="0.0" y="0.0" width="200" height="40"/> | ||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> | ||
<subviews> | ||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="LNM-4r-Da5"> | ||
<rect key="frame" x="38" y="5" width="124" height="30"/> | ||
<subviews> | ||
<stackView opaque="NO" contentMode="scaleToFill" spacing="4" translatesAutoresizingMaskIntoConstraints="NO" id="I2y-vF-Qin"> | ||
<rect key="frame" x="7" y="5" width="110" height="20"/> | ||
<subviews> | ||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="이마트 성수점" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="gal-vv-uIe"> | ||
<rect key="frame" x="0.0" y="0.0" width="86" height="20"/> | ||
<fontDescription key="fontDescription" name="NanumSquareRoundOTFR" family="NanumSquareRoundOTF" pointSize="15"/> | ||
<nil key="textColor"/> | ||
<nil key="highlightedColor"/> | ||
</label> | ||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="rightArrow" translatesAutoresizingMaskIntoConstraints="NO" id="HIa-Wt-TSC"> | ||
<rect key="frame" x="90" y="0.0" width="20" height="20"/> | ||
</imageView> | ||
</subviews> | ||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> | ||
<constraints> | ||
<constraint firstAttribute="height" constant="20" id="d9M-Uw-KMG"/> | ||
</constraints> | ||
</stackView> | ||
</subviews> | ||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> | ||
<constraints> | ||
<constraint firstAttribute="height" secondItem="I2y-vF-Qin" secondAttribute="height" multiplier="1.5" id="S28-nF-rQn"/> | ||
<constraint firstAttribute="trailing" secondItem="I2y-vF-Qin" secondAttribute="trailing" constant="7" id="ZRN-Ht-N9V"/> | ||
<constraint firstItem="I2y-vF-Qin" firstAttribute="centerY" secondItem="LNM-4r-Da5" secondAttribute="centerY" id="nRl-If-v7W"/> | ||
<constraint firstItem="I2y-vF-Qin" firstAttribute="leading" secondItem="LNM-4r-Da5" secondAttribute="leading" constant="7" id="uRm-gx-zG2"/> | ||
</constraints> | ||
</view> | ||
</subviews> | ||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> | ||
<constraints> | ||
<constraint firstItem="LNM-4r-Da5" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="centerY" id="PfA-Ks-2Lm"/> | ||
<constraint firstItem="LNM-4r-Da5" firstAttribute="centerX" secondItem="iN0-l3-epB" secondAttribute="centerX" id="WIN-Vd-Q3A"/> | ||
</constraints> | ||
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/> | ||
<point key="canvasLocation" x="-222" y="-117"/> | ||
</view> | ||
</objects> | ||
<resources> | ||
<image name="rightArrow" width="20" height="20"/> | ||
</resources> | ||
</document> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters