Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Create the basic app in English

  • Loading branch information...
commit 7e95efa8e9e8c39337abfd831d1427c0522c14bd 1 parent fb9ef33
@Abizern authored
View
BIN  Images/fish_n_chips.jpg
Deleted file not rendered
View
BIN  Images/fish_n_chips.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
35 LocalisingTestiOS/LocalisingTestiOS.xcodeproj/project.pbxproj
@@ -15,6 +15,12 @@
AD45F50C1515501300761091 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = AD45F50B1515501300761091 /* AppDelegate.m */; };
AD45F50F1515501300761091 /* MainStoryboard.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = AD45F50D1515501300761091 /* MainStoryboard.storyboard */; };
AD45F5121515501300761091 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = AD45F5111515501300761091 /* ViewController.m */; };
+ AD45F51915155EFA00761091 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AD45F51815155EFA00761091 /* QuartzCore.framework */; };
+ AD45F51D1515713600761091 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = AD45F51C1515713600761091 /* Localizable.strings */; };
+ ADA8581115157CE00091AADE /* fish_n_chips.png in Resources */ = {isa = PBXBuildFile; fileRef = ADA8580D15157CE00091AADE /* fish_n_chips.png */; };
+ ADA8581215157CE00091AADE /* fish_n_chips@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = ADA8580E15157CE00091AADE /* fish_n_chips@2x.png */; };
+ ADA8581315157CE00091AADE /* paella.png in Resources */ = {isa = PBXBuildFile; fileRef = ADA8580F15157CE00091AADE /* paella.png */; };
+ ADA8581415157CE00091AADE /* paella@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = ADA8581015157CE00091AADE /* paella@2x.png */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
@@ -31,6 +37,12 @@
AD45F50E1515501300761091 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = en; path = en.lproj/MainStoryboard.storyboard; sourceTree = "<group>"; };
AD45F5101515501300761091 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = "<group>"; };
AD45F5111515501300761091 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = "<group>"; };
+ AD45F51815155EFA00761091 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
+ AD45F51C1515713600761091 /* Localizable.strings */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; path = Localizable.strings; sourceTree = "<group>"; };
+ ADA8580D15157CE00091AADE /* fish_n_chips.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = fish_n_chips.png; path = ../../Images/fish_n_chips.png; sourceTree = "<group>"; };
+ ADA8580E15157CE00091AADE /* fish_n_chips@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "fish_n_chips@2x.png"; path = "../../Images/fish_n_chips@2x.png"; sourceTree = "<group>"; };
+ ADA8580F15157CE00091AADE /* paella.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = paella.png; path = ../../Images/paella.png; sourceTree = "<group>"; };
+ ADA8581015157CE00091AADE /* paella@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "paella@2x.png"; path = "../../Images/paella@2x.png"; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -38,6 +50,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
+ AD45F51915155EFA00761091 /* QuartzCore.framework in Frameworks */,
AD45F4FC1515501300761091 /* UIKit.framework in Frameworks */,
AD45F4FE1515501300761091 /* Foundation.framework in Frameworks */,
AD45F5001515501300761091 /* CoreGraphics.framework in Frameworks */,
@@ -70,6 +83,7 @@
AD45F4FB1515501300761091 /* UIKit.framework */,
AD45F4FD1515501300761091 /* Foundation.framework */,
AD45F4FF1515501300761091 /* CoreGraphics.framework */,
+ AD45F51815155EFA00761091 /* QuartzCore.framework */,
);
name = Frameworks;
sourceTree = "<group>";
@@ -90,6 +104,8 @@
AD45F5021515501300761091 /* Supporting Files */ = {
isa = PBXGroup;
children = (
+ ADA8581615157D710091AADE /* Images */,
+ AD45F51C1515713600761091 /* Localizable.strings */,
AD45F5031515501300761091 /* Info.plist */,
AD45F5041515501300761091 /* InfoPlist.strings */,
AD45F5071515501300761091 /* main.m */,
@@ -98,6 +114,17 @@
name = "Supporting Files";
sourceTree = "<group>";
};
+ ADA8581615157D710091AADE /* Images */ = {
+ isa = PBXGroup;
+ children = (
+ ADA8580D15157CE00091AADE /* fish_n_chips.png */,
+ ADA8580E15157CE00091AADE /* fish_n_chips@2x.png */,
+ ADA8580F15157CE00091AADE /* paella.png */,
+ ADA8581015157CE00091AADE /* paella@2x.png */,
+ );
+ name = Images;
+ sourceTree = "<group>";
+ };
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
@@ -149,8 +176,13 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
+ ADA8581115157CE00091AADE /* fish_n_chips.png in Resources */,
+ ADA8581215157CE00091AADE /* fish_n_chips@2x.png in Resources */,
+ ADA8581315157CE00091AADE /* paella.png in Resources */,
+ ADA8581415157CE00091AADE /* paella@2x.png in Resources */,
AD45F5061515501300761091 /* InfoPlist.strings in Resources */,
AD45F50F1515501300761091 /* MainStoryboard.storyboard in Resources */,
+ AD45F51D1515713600761091 /* Localizable.strings in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -241,6 +273,7 @@
GCC_PREFIX_HEADER = LocalisingTestiOS/Prefix.pch;
INFOPLIST_FILE = LocalisingTestiOS/Info.plist;
PRODUCT_NAME = "$(TARGET_NAME)";
+ RUN_CLANG_STATIC_ANALYZER = YES;
WRAPPER_EXTENSION = app;
};
name = Debug;
@@ -252,6 +285,7 @@
GCC_PREFIX_HEADER = LocalisingTestiOS/Prefix.pch;
INFOPLIST_FILE = LocalisingTestiOS/Info.plist;
PRODUCT_NAME = "$(TARGET_NAME)";
+ RUN_CLANG_STATIC_ANALYZER = YES;
WRAPPER_EXTENSION = app;
};
name = Release;
@@ -275,6 +309,7 @@
AD45F5171515501300761091 /* Release */,
);
defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
View
BIN  LocalisingTestiOS/LocalisingTestiOS/Localizable.strings
Binary file not shown
View
1  LocalisingTestiOS/LocalisingTestiOS/Prefix.pch
@@ -11,4 +11,5 @@
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
+ #import <QuartzCore/QuartzCore.h>
#endif
View
5 LocalisingTestiOS/LocalisingTestiOS/ViewController.h
@@ -9,4 +9,9 @@
@interface ViewController : UIViewController
+@property (weak, nonatomic) IBOutlet UILabel *label;
+@property (weak, nonatomic) IBOutlet UIButton *button;
+
+- (IBAction)buttonClicked:(id)sender;
+
@end
View
95 LocalisingTestiOS/LocalisingTestiOS/ViewController.m
@@ -5,26 +5,117 @@
// Created by Abizer Nasir on 17/03/2012.
//
+static NSString* const kImageFile = @"kImageFile";
+static NSString* const kLabelText = @"kLabelText";
+static NSString* const kInitialButtonText = @"kInitialButtonText";
+static NSString* const kAlternateButtonText = @"kAlternateButtonText";
+
#import "ViewController.h"
+#import <QuartzCore/QuartzCore.h>
@interface ViewController ()
+@property (assign, nonatomic) BOOL imageShowing;
+@property (strong, nonatomic) CALayer *imageLayer;
+@property (assign, nonatomic) CGPoint initialImageLayerPosition;
+@property (assign, nonatomic) CGPoint displayImageLayerPosition;
+
+- (void)setupImageLayer;
+- (void)updateLabelText;
+- (void)updateButtonText;
+
@end
@implementation ViewController
+@synthesize label = _label;
+@synthesize button = _button;
+@synthesize imageShowing = _imageShowing;
+@synthesize imageLayer = _imageLayer;
+@synthesize initialImageLayerPosition = _initialImageLayerPosition;
+@synthesize displayImageLayerPosition = _displayImageLayerPosition;
- (void)viewDidLoad {
[super viewDidLoad];
- // Do any additional setup after loading the view, typically from a nib.
+ self.imageShowing = NO;
+
+ self.initialImageLayerPosition = CGPointMake(160.0f, -120.0f);
+ self.displayImageLayerPosition = CGPointMake(160.0f, 120.0f);
+
+ [self updateLabelText];
+ [self updateButtonText];
+
+ [self setupImageLayer];
}
- (void)viewDidUnload {
+ self.label = nil;
+ self.imageLayer = nil;
+
+ [self setButton:nil];
[super viewDidUnload];
- // Release any retained subviews of the main view.
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return interfaceOrientation == UIInterfaceOrientationPortrait;
}
+#pragma mark - IBActions
+
+- (IBAction)buttonClicked:(id)sender {
+ if (self.imageShowing) {
+ self.imageShowing = NO;
+
+ self.imageLayer.position = self.initialImageLayerPosition;
+
+ [self updateLabelText];
+ [self updateButtonText];
+ } else {
+ self.imageShowing = YES;
+
+ self.imageLayer.position = self.displayImageLayerPosition;
+
+ [self updateLabelText];
+ [self updateButtonText];
+ }
+}
+
+#pragma mark - private helper methods
+
+- (void)setupImageLayer {
+ CALayer *theLayer = [CALayer layer];
+
+ theLayer.bounds = CGRectMake(0.0f, 0.0f, 320.0f, 240.0f);
+ theLayer.position = self.initialImageLayerPosition;
+
+ theLayer.contentsGravity = kCAGravityCenter;
+ theLayer.contentsScale = [[UIScreen mainScreen] scale];
+ NSString *imageFileName = NSLocalizedString(kImageFile, @"The name of the image file");
+ theLayer.contents = (id)[UIImage imageNamed:imageFileName].CGImage;
+
+ self.imageLayer = theLayer;
+ [self.view.layer addSublayer:self.imageLayer];
+}
+
+- (void)updateLabelText {
+ NSString *text = nil;
+ if (self.imageShowing) {
+ text = NSLocalizedString(kLabelText, @"Shut up and eat");
+ } else {
+ text = @"";
+ }
+ self.label.text = text;
+}
+
+- (void)updateButtonText {
+ NSString *text = nil;
+
+ if (self.imageShowing) {
+ text = NSLocalizedString(kAlternateButtonText, @"Alternate button text 'Ok'");
+ } else {
+ text = NSLocalizedString(kInitialButtonText, @"Initial button text 'What should I do'");
+ }
+
+ [self.button setTitle:text forState:UIControlStateNormal];
+}
+
@end
View
46 LocalisingTestiOS/LocalisingTestiOS/en.lproj/MainStoryboard.storyboard
@@ -1,10 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="1.0" toolsVersion="1906" systemVersion="11A511" targetRuntime="iOS.CocoaTouch" nextObjectID="6" propertyAccessControl="none" initialViewController="2">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="1.1" toolsVersion="2182" systemVersion="11D50" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" initialViewController="2">
<dependencies>
+ <deployment defaultVersion="1296" identifier="iOS"/>
<development defaultVersion="4200" identifier="xcode"/>
- <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="902"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="1179"/>
</dependencies>
<scenes>
+ <!--View Controller-->
<scene sceneID="5">
<objects>
<placeholder placeholderIdentifier="IBFirstResponder" id="4" sceneMemberID="firstResponder"/>
@@ -12,13 +14,51 @@
<view key="view" contentMode="scaleToFill" id="3">
<rect key="frame" x="0.0" y="20" width="320" height="460"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
- <subviews/>
+ <subviews>
+ <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="oY4-gK-AWy">
+ <rect key="frame" x="82" y="376" width="156" height="37"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+ <fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>
+ <state key="normal">
+ <color key="titleColor" red="0.19607843459999999" green="0.30980393290000002" blue="0.52156865600000002" alpha="1" colorSpace="calibratedRGB"/>
+ <color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
+ </state>
+ <state key="highlighted">
+ <color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+ </state>
+ <connections>
+ <action selector="buttonClicked:" destination="2" eventType="touchUpInside" id="QUU-W8-uZe"/>
+ </connections>
+ </button>
+ <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="10" id="pIj-o4-tM2">
+ <rect key="frame" x="20" y="285" width="280" height="21"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+ <fontDescription key="fontDescription" type="system" pointSize="17"/>
+ <color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
+ <nil key="highlightedColor"/>
+ </label>
+ </subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
+ <connections>
+ <outlet property="button" destination="oY4-gK-AWy" id="c0y-kr-fo5"/>
+ <outlet property="label" destination="pIj-o4-tM2" id="YYc-Qk-N8G"/>
+ </connections>
</viewController>
</objects>
+ <point key="canvasLocation" x="-200" y="133"/>
</scene>
</scenes>
+ <classes>
+ <class className="ViewController" superclassName="UIViewController">
+ <source key="sourceIdentifier" type="project" relativePath="./Classes/ViewController.h"/>
+ <relationships>
+ <relationship kind="action" name="buttonClicked:"/>
+ <relationship kind="outlet" name="button" candidateClass="UIButton"/>
+ <relationship kind="outlet" name="label" candidateClass="UILabel"/>
+ </relationships>
+ </class>
+ </classes>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
<simulatedStatusBarMetrics key="statusBar"/>
<simulatedOrientationMetrics key="orientation"/>
View
16 SimpleLocalisationTesting.xcworkspace/contents.xcworkspacedata
@@ -1,22 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
- <Group
- location = "group:Images"
- name = "Images">
- <FileRef
- location = "group:fish_n_chips.jpg">
- </FileRef>
- <FileRef
- location = "group:fish_n_chips@2x.png">
- </FileRef>
- <FileRef
- location = "group:paella.png">
- </FileRef>
- <FileRef
- location = "group:paella@2x.png">
- </FileRef>
- </Group>
<FileRef
location = "group:LocalisingTestiOS/LocalisingTestiOS.xcodeproj">
</FileRef>
Please sign in to comment.
Something went wrong with that request. Please try again.