Commit 4c4ec645 by Javier Heisekce

Mostramos números correctamente

parent ef27a35c
......@@ -62,40 +62,90 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="SSh-qK-Te0">
<rect key="frame" x="16" y="73" width="100" height="100"/>
<rect key="frame" x="137" y="69" width="100" height="100"/>
<constraints>
<constraint firstAttribute="height" constant="100" id="GFa-s9-VDx"/>
<constraint firstAttribute="width" constant="100" id="zm3-wz-QlG"/>
<constraint firstAttribute="height" constant="100" id="n9x-Ru-z25"/>
<constraint firstAttribute="width" constant="100" id="nPy-0W-mhe"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="KATE FODSFUBSDIFUBSD" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="1Kw-mC-GdR">
<rect key="frame" x="124" y="70" width="236.5" height="24"/>
<fontDescription key="fontDescription" style="UICTFontTextStyleTitle3"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="KATE FODSFUBSDIFUBSD" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="1Kw-mC-GdR">
<rect key="frame" x="58" y="177" width="259" height="27"/>
<constraints>
<constraint firstAttribute="height" constant="27" id="4T0-IY-YZ1"/>
</constraints>
<fontDescription key="fontDescription" style="UICTFontTextStyleTitle2"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="eBo-CT-x9g">
<rect key="frame" x="58" y="212" width="30" height="30"/>
<state key="normal" title="Call"/>
<connections>
<action selector="callButton:" destination="i2T-MY-6qf" eventType="touchUpInside" id="nXp-Mk-RCH"/>
</connections>
</button>
<label hidden="YES" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="mobile" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="KxJ-Qv-kA7">
<rect key="frame" x="16" y="240" width="44" height="17"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="6Eu-n5-bWt">
<rect key="frame" x="124" y="113" width="48" height="24"/>
<fontDescription key="fontDescription" style="UICTFontTextStyleTitle3"/>
<color key="textColor" systemColor="systemBlueColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<button hidden="YES" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="m4m-IH-dYv">
<rect key="frame" x="16" y="259" width="111" height="30"/>
<state key="normal" title="(888) 555-5512"/>
<connections>
<action selector="callButton:" destination="i2T-MY-6qf" eventType="touchUpInside" id="H4b-52-ngQ"/>
</connections>
</button>
<label hidden="YES" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="mobile" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="vQF-Eq-KWL">
<rect key="frame" x="18" y="297" width="44" height="17"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<button hidden="YES" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="78U-Dh-WFs">
<rect key="frame" x="18" y="316" width="111" height="30"/>
<state key="normal" title="(888) 555-5512"/>
<connections>
<action selector="callButton:" destination="i2T-MY-6qf" eventType="touchUpInside" id="xgn-e5-2aF"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<constraints>
<constraint firstItem="6Eu-n5-bWt" firstAttribute="leading" secondItem="SSh-qK-Te0" secondAttribute="trailing" constant="8" id="KY6-oD-zqi"/>
<constraint firstItem="1Kw-mC-GdR" firstAttribute="leading" secondItem="SSh-qK-Te0" secondAttribute="trailing" constant="8" id="Ogd-VN-JDE"/>
<constraint firstItem="1Kw-mC-GdR" firstAttribute="top" secondItem="YV1-WY-lTn" secondAttribute="top" constant="26" id="YZK-KY-6DD"/>
<constraint firstItem="6Eu-n5-bWt" firstAttribute="top" secondItem="1Kw-mC-GdR" secondAttribute="bottom" constant="19" id="YuN-VJ-nj8"/>
<constraint firstItem="SSh-qK-Te0" firstAttribute="top" secondItem="1Kw-mC-GdR" secondAttribute="bottom" constant="-21" id="a1j-Kp-lBQ"/>
<constraint firstItem="SSh-qK-Te0" firstAttribute="leading" secondItem="T9g-Qz-Xx3" secondAttribute="leadingMargin" id="z7n-CK-Jte"/>
<constraint firstItem="YV1-WY-lTn" firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="m4m-IH-dYv" secondAttribute="trailing" symbolic="YES" id="1AC-tb-Lsi"/>
<constraint firstItem="SSh-qK-Te0" firstAttribute="leading" secondItem="YV1-WY-lTn" secondAttribute="leading" constant="137" id="5ra-OQ-OXE"/>
<constraint firstItem="78U-Dh-WFs" firstAttribute="top" secondItem="vQF-Eq-KWL" secondAttribute="bottom" constant="2" id="7Qu-oy-WiY"/>
<constraint firstItem="KxJ-Qv-kA7" firstAttribute="top" secondItem="eBo-CT-x9g" secondAttribute="bottom" constant="-2" id="AbZ-R1-uip"/>
<constraint firstItem="eBo-CT-x9g" firstAttribute="top" secondItem="1Kw-mC-GdR" secondAttribute="bottom" constant="8" id="AqY-Nn-a6x"/>
<constraint firstItem="vQF-Eq-KWL" firstAttribute="leading" secondItem="YV1-WY-lTn" secondAttribute="leading" constant="18" id="I0k-GE-QJ0"/>
<constraint firstItem="YV1-WY-lTn" firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="78U-Dh-WFs" secondAttribute="trailing" symbolic="YES" id="KQY-U5-hvm"/>
<constraint firstItem="1Kw-mC-GdR" firstAttribute="top" secondItem="SSh-qK-Te0" secondAttribute="bottom" constant="8" id="Ktz-1f-c23"/>
<constraint firstItem="m4m-IH-dYv" firstAttribute="leading" secondItem="YV1-WY-lTn" secondAttribute="leading" constant="16" id="Ky9-D3-Q8g"/>
<constraint firstItem="vQF-Eq-KWL" firstAttribute="top" secondItem="m4m-IH-dYv" secondAttribute="bottom" constant="8" id="NnL-pe-PyE"/>
<constraint firstItem="eBo-CT-x9g" firstAttribute="leading" secondItem="1Kw-mC-GdR" secondAttribute="leading" id="P95-3L-FTz"/>
<constraint firstItem="YV1-WY-lTn" firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="eBo-CT-x9g" secondAttribute="trailing" symbolic="YES" id="S0r-tt-H4L"/>
<constraint firstItem="YV1-WY-lTn" firstAttribute="trailing" secondItem="SSh-qK-Te0" secondAttribute="trailing" constant="138" id="SoA-lc-Ayp"/>
<constraint firstItem="m4m-IH-dYv" firstAttribute="top" secondItem="KxJ-Qv-kA7" secondAttribute="bottom" constant="2" id="cXc-j4-79C"/>
<constraint firstItem="78U-Dh-WFs" firstAttribute="leading" secondItem="YV1-WY-lTn" secondAttribute="leading" constant="18" id="cc2-xi-9qt"/>
<constraint firstItem="1Kw-mC-GdR" firstAttribute="leading" secondItem="YV1-WY-lTn" secondAttribute="leading" constant="58" id="epS-Yc-0NF"/>
<constraint firstItem="SSh-qK-Te0" firstAttribute="top" secondItem="YV1-WY-lTn" secondAttribute="top" constant="25" id="jxI-6w-TU6"/>
<constraint firstItem="YV1-WY-lTn" firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="vQF-Eq-KWL" secondAttribute="trailing" symbolic="YES" id="nUf-po-YIk"/>
<constraint firstItem="YV1-WY-lTn" firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="KxJ-Qv-kA7" secondAttribute="trailing" symbolic="YES" id="rJB-y4-kit"/>
<constraint firstItem="YV1-WY-lTn" firstAttribute="trailing" secondItem="1Kw-mC-GdR" secondAttribute="trailing" constant="58" id="rtf-K6-ZTK"/>
<constraint firstItem="KxJ-Qv-kA7" firstAttribute="leading" secondItem="YV1-WY-lTn" secondAttribute="leading" constant="16" id="zOD-Bq-oI1"/>
</constraints>
<viewLayoutGuide key="safeArea" id="YV1-WY-lTn"/>
</view>
<navigationItem key="navigationItem" id="y8U-qe-KjJ"/>
<navigationItem key="navigationItem" id="y8U-qe-KjJ">
<barButtonItem key="backBarButtonItem" title="Contacts" id="4iP-Za-MPC"/>
</navigationItem>
<connections>
<outlet property="contactFullname" destination="1Kw-mC-GdR" id="p01-Rh-EGg"/>
<outlet property="phoneNumber" destination="6Eu-n5-bWt" id="T4T-Ts-Lbq"/>
<outlet property="otherPhoneLabel" destination="vQF-Eq-KWL" id="6bS-Cs-Wse"/>
<outlet property="otherPhoneNumber" destination="78U-Dh-WFs" id="3oC-ap-6pF"/>
<outlet property="phoneLabel" destination="KxJ-Qv-kA7" id="fjD-LM-At1"/>
<outlet property="phoneNumber" destination="m4m-IH-dYv" id="Ilr-VL-oU5"/>
<outlet property="profilePic" destination="SSh-qK-Te0" id="raT-yr-aQm"/>
</connections>
</viewController>
......
......@@ -25,7 +25,7 @@ class ContactsViewController: UIViewController {
func importContacts() {
let keys = [CNContactFormatter.descriptorForRequiredKeys(for: .fullName), CNContactEmailAddressesKey, CNContactPhoneNumbersKey, CNContactImageDataKey, CNContactImageDataAvailableKey] as [Any]
let keys = [CNContactFormatter.descriptorForRequiredKeys(for: .fullName), CNContactEmailAddressesKey, CNContactPhoneNumbersKey, CNContactImageDataKey] as [Any]
let request = CNContactFetchRequest( keysToFetch: keys as! [CNKeyDescriptor])
request.sortOrder = CNContactSortOrder.givenName
do {
......@@ -52,9 +52,6 @@ class ContactsViewController: UIViewController {
}
}
self.contactStructArray.append(ContactStruct(isExpanded: true, contacts: contacts, letter: auxLetter)) //agregamos el ultimo nombre
print("CONTACTOS ORDENADOS")
print(self.contactStructArray)
print("======================")
}
catch {
print("unable to fetch contacts")
......
......@@ -14,24 +14,40 @@ class SingleContactViewController: UIViewController {
@IBOutlet weak var contactFullname: UILabel!
var selectedContact : CNContact?
@IBOutlet weak var profilePic: UIImageView!
@IBOutlet weak var phoneNumber: UILabel!
@IBOutlet weak var phoneNumber: UIButton!
@IBOutlet weak var otherPhoneNumber: UIButton!
@IBOutlet weak var otherPhoneLabel: UILabel!
@IBOutlet weak var phoneLabel: UILabel!
override func viewDidLoad() {
super.viewDidLoad()
if let contact = selectedContact{
title = "\(contact.givenName) \(contact.familyName)"
contactFullname.text = "\(contact.givenName) \(contact.familyName)"
//phoneNumber.text = CNLabeledValue.localizedStringForLabel(contact.phoneNumbers)
if contact.imageDataAvailable {
if let phones = contact.phoneNumbers.first {
let phoneTitle :String = CNLabeledValue<NSString>.localizedString(forLabel: phones.label! )
phoneLabel.text = phoneTitle
phoneNumber.setTitle(phones.value.stringValue, for: .normal)
phoneLabel.isHidden = false
phoneNumber.isHidden = false
}
if contact.phoneNumbers.last != contact.phoneNumbers.first, let phones = contact.phoneNumbers.last {
let phoneTitle :String = CNLabeledValue<NSString>.localizedString(forLabel: phones.label! )
otherPhoneLabel.text = phoneTitle
otherPhoneNumber.setTitle(phones.value.stringValue, for: .normal)
otherPhoneLabel.isHidden = false
otherPhoneNumber.isHidden = false
}
if let image = contact.imageData {
profilePic.layer.cornerRadius = profilePic.frame.height / 2
if let imageData = UIImage(data: image){
profilePic.image = imageData
}
}
}
}
@IBAction func callButton(_ sender: Any) {
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment