Skip to content

Commit 5f99400

Browse files
committed
Se agrega la funcionalidad y el diseño al Storyboard
1 parent 1904dbb commit 5f99400

File tree

2 files changed

+108
-6
lines changed

2 files changed

+108
-6
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,100 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="17156" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
3+
<device id="retina6_1" orientation="portrait" appearance="light"/>
34
<dependencies>
4-
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
5+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17125"/>
56
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
7+
<capability name="System colors in document resources" minToolsVersion="11.0"/>
68
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
79
</dependencies>
810
<scenes>
911
<!--View Controller-->
1012
<scene sceneID="tne-QT-ifu">
1113
<objects>
12-
<viewController id="BYZ-38-t0r" customClass="ViewController" customModuleProvider="" sceneMemberID="viewController">
14+
<viewController id="BYZ-38-t0r" customClass="ViewController" sceneMemberID="viewController">
1315
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
14-
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
16+
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
1517
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
16-
<color key="backgroundColor" xcode11CocoaTouchSystemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
18+
<subviews>
19+
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="22" translatesAutoresizingMaskIntoConstraints="NO" id="AAY-oq-o6m">
20+
<rect key="frame" x="31" y="53" width="69.5" height="148"/>
21+
<subviews>
22+
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Campo 1" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="NGO-C6-QPX">
23+
<rect key="frame" x="0.0" y="0.0" width="69.5" height="20.5"/>
24+
<fontDescription key="fontDescription" type="system" pointSize="17"/>
25+
<nil key="textColor"/>
26+
<nil key="highlightedColor"/>
27+
</label>
28+
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Campo 2" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="KaJ-F7-jU3">
29+
<rect key="frame" x="0.0" y="42.5" width="69.5" height="20.5"/>
30+
<fontDescription key="fontDescription" type="system" pointSize="17"/>
31+
<nil key="textColor"/>
32+
<nil key="highlightedColor"/>
33+
</label>
34+
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Campo 3" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="VrD-v5-khe">
35+
<rect key="frame" x="0.0" y="85" width="69.5" height="20.5"/>
36+
<fontDescription key="fontDescription" type="system" pointSize="17"/>
37+
<nil key="textColor"/>
38+
<nil key="highlightedColor"/>
39+
</label>
40+
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Campo 4" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="lbF-qA-fst">
41+
<rect key="frame" x="0.0" y="127.5" width="69.5" height="20.5"/>
42+
<fontDescription key="fontDescription" type="system" pointSize="17"/>
43+
<nil key="textColor"/>
44+
<nil key="highlightedColor"/>
45+
</label>
46+
</subviews>
47+
</stackView>
48+
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="10" translatesAutoresizingMaskIntoConstraints="NO" id="Mo2-mX-cN9">
49+
<rect key="frame" x="293.5" y="44" width="100.5" height="166"/>
50+
<subviews>
51+
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="campo1" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="2aq-Bv-g4U">
52+
<rect key="frame" x="0.0" y="0.0" width="100.5" height="34"/>
53+
<fontDescription key="fontDescription" type="system" pointSize="20"/>
54+
<textInputTraits key="textInputTraits"/>
55+
</textField>
56+
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="campo2" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="3fU-mx-jcH">
57+
<rect key="frame" x="0.0" y="44" width="100.5" height="34"/>
58+
<fontDescription key="fontDescription" type="system" pointSize="20"/>
59+
<textInputTraits key="textInputTraits"/>
60+
</textField>
61+
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="campo3" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="qNp-NS-sri">
62+
<rect key="frame" x="0.0" y="88" width="100.5" height="34"/>
63+
<fontDescription key="fontDescription" type="system" pointSize="20"/>
64+
<textInputTraits key="textInputTraits"/>
65+
</textField>
66+
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="campo4" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="tYP-XY-SuA">
67+
<rect key="frame" x="0.0" y="132" width="100.5" height="34"/>
68+
<fontDescription key="fontDescription" type="system" pointSize="20"/>
69+
<textInputTraits key="textInputTraits"/>
70+
</textField>
71+
</subviews>
72+
</stackView>
73+
</subviews>
1774
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
75+
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
76+
<constraints>
77+
<constraint firstItem="Mo2-mX-cN9" firstAttribute="trailing" secondItem="8bC-Xf-vdC" secondAttribute="trailingMargin" id="Fl5-OE-XLS"/>
78+
<constraint firstItem="AAY-oq-o6m" firstAttribute="centerY" secondItem="Mo2-mX-cN9" secondAttribute="centerY" id="aeY-JI-Gb8"/>
79+
<constraint firstItem="Mo2-mX-cN9" firstAttribute="top" secondItem="6Tk-OE-BBY" secondAttribute="top" id="bSL-0G-CCI"/>
80+
<constraint firstItem="AAY-oq-o6m" firstAttribute="leading" secondItem="6Tk-OE-BBY" secondAttribute="leading" constant="31" id="cxz-LN-efP"/>
81+
</constraints>
1882
</view>
83+
<connections>
84+
<outletCollection property="linefields" destination="2aq-Bv-g4U" id="Xhl-UA-F7g"/>
85+
<outletCollection property="linefields" destination="3fU-mx-jcH" id="4kS-ad-rUS"/>
86+
<outletCollection property="linefields" destination="qNp-NS-sri" id="nRd-RU-8bQ"/>
87+
<outletCollection property="linefields" destination="tYP-XY-SuA" id="9P3-0v-C0A"/>
88+
</connections>
1989
</viewController>
2090
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
2191
</objects>
92+
<point key="canvasLocation" x="140.57971014492756" y="66.964285714285708"/>
2293
</scene>
2394
</scenes>
95+
<resources>
96+
<systemColor name="systemBackgroundColor">
97+
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
98+
</systemColor>
99+
</resources>
24100
</document>

persistenceDataTextFields/ViewController.m

+27-1
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,40 @@
88
#import "ViewController.h"
99

1010
@interface ViewController ()
11-
11+
@property (strong,nonatomic) IBOutletCollection(UITextField) NSArray *linefields;
1212
@end
1313

1414
@implementation ViewController
1515

1616
- (void)viewDidLoad {
1717
[super viewDidLoad];
1818
// Do any additional setup after loading the view.
19+
NSString *filepath = [self dataFilePath];
20+
if([[NSFileManager defaultManager] fileExistsAtPath:filepath]){
21+
NSArray *array = [[NSArray alloc] initWithContentsOfFile:filepath];
22+
for (int i = 0; i<4; i++) {
23+
UITextField *theField = self.linefields[i];
24+
theField.text = array[i];
25+
}
26+
}
27+
28+
UIApplication *app = [UIApplication sharedApplication];
29+
30+
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationWillResignActive:) name:UIApplicationWillResignActiveNotification object:app];
31+
32+
33+
}
34+
35+
-(void)applicationWillResignActive:(NSNotification *)notification{
36+
NSString *filePath = [self dataFilePath];
37+
NSArray *array = [self.linefields valueForKey:@"text"];
38+
[array writeToFile:filePath atomically:YES];
39+
}
40+
41+
-(NSString *)dataFilePath{
42+
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
43+
NSString *documentsDirectory = [paths objectAtIndex:0];
44+
return [documentsDirectory stringByAppendingPathComponent:@"data.plist"];
1945
}
2046

2147

0 commit comments

Comments
 (0)