summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2013-06-12 21:11:14 -0600
committermo khan <mo@mokhan.ca>2013-06-12 21:11:14 -0600
commitb738edd6942dbf4964e5958cc257399627f93260 (patch)
tree5fa70a980655751034d7cbc5f5058bdd6396d729
parentfa4edf3e32077243ec9af3f087771d52b1530643 (diff)
disable autolayout and now the animation works
-rw-r--r--Wobble.xcodeproj/project.xcworkspace/xcuserdata/mo.xcuserdatad/UserInterfaceState.xcuserstatebin16229 -> 16301 bytes
-rw-r--r--Wobble.xcodeproj/xcuserdata/mo.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist41
-rw-r--r--Wobble/ViewController.m24
-rw-r--r--Wobble/en.lproj/ViewController.xib208
-rw-r--r--Wobble/main.m8
5 files changed, 30 insertions, 251 deletions
diff --git a/Wobble.xcodeproj/project.xcworkspace/xcuserdata/mo.xcuserdatad/UserInterfaceState.xcuserstate b/Wobble.xcodeproj/project.xcworkspace/xcuserdata/mo.xcuserdatad/UserInterfaceState.xcuserstate
index 4853b19..47bb2da 100644
--- a/Wobble.xcodeproj/project.xcworkspace/xcuserdata/mo.xcuserdatad/UserInterfaceState.xcuserstate
+++ b/Wobble.xcodeproj/project.xcworkspace/xcuserdata/mo.xcuserdatad/UserInterfaceState.xcuserstate
Binary files differ
diff --git a/Wobble.xcodeproj/xcuserdata/mo.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist b/Wobble.xcodeproj/xcuserdata/mo.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist
index cc6c8cb..05301bc 100644
--- a/Wobble.xcodeproj/xcuserdata/mo.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist
+++ b/Wobble.xcodeproj/xcuserdata/mo.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist
@@ -2,45 +2,4 @@
<Bucket
type = "1"
version = "1.0">
- <FileBreakpoints>
- <FileBreakpoint
- shouldBeEnabled = "No"
- ignoreCount = "0"
- continueAfterRunningActions = "No"
- filePath = "Wobble/ViewController.m"
- timestampString = "392784721.896058"
- startingColumnNumber = "9223372036854775807"
- endingColumnNumber = "9223372036854775807"
- startingLineNumber = "21"
- endingLineNumber = "21"
- landmarkName = "-onTouch:"
- landmarkType = "5">
- </FileBreakpoint>
- <FileBreakpoint
- shouldBeEnabled = "No"
- ignoreCount = "0"
- continueAfterRunningActions = "No"
- filePath = "Wobble/ViewController.m"
- timestampString = "392784721.896058"
- startingColumnNumber = "9223372036854775807"
- endingColumnNumber = "9223372036854775807"
- startingLineNumber = "27"
- endingLineNumber = "27"
- landmarkName = "-moveBallToRandomLocation"
- landmarkType = "5">
- </FileBreakpoint>
- <FileBreakpoint
- shouldBeEnabled = "No"
- ignoreCount = "0"
- continueAfterRunningActions = "No"
- filePath = "Wobble/ViewController.m"
- timestampString = "392784721.896058"
- startingColumnNumber = "9223372036854775807"
- endingColumnNumber = "9223372036854775807"
- startingLineNumber = "29"
- endingLineNumber = "29"
- landmarkName = "-moveBallToRandomLocation"
- landmarkType = "5">
- </FileBreakpoint>
- </FileBreakpoints>
</Bucket>
diff --git a/Wobble/ViewController.m b/Wobble/ViewController.m
index f24f61a..d0bddd7 100644
--- a/Wobble/ViewController.m
+++ b/Wobble/ViewController.m
@@ -13,26 +13,32 @@
[self.ball addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onTouch:)]];
}
--(void)onTouch:(UIGestureRecognizer *)sender
+-(CGPoint)createRandomLocationFor:(CGPoint)currentLocation
{
- [self moveBallToRandomLocation];
- self.score += 2;
- self.scoreLabel.text = [NSString stringWithFormat:@"%d", self.score];
+ CGPoint newLocation = currentLocation;
+ newLocation.y = (float)random() / RAND_MAX * 940 + 32;
+ newLocation.x = (float)random() / RAND_MAX * 704 + 32;
+ NSLog(@"moving to %f %f", newLocation.x, newLocation.y);
+ return newLocation;
}
- (void)moveBallToRandomLocation
{
[UIView animateWithDuration:1 delay:0 options:UIViewAnimationOptionCurveEaseInOut animations:^
{
- CGPoint newLocation = self.ball.center;
- newLocation.y = (float)random() / RAND_MAX * 940 + 32;
- newLocation.x = (float)random() / RAND_MAX * 704 + 32;
- NSLog(@"Moving to %f %f", newLocation.x, newLocation.y);
- self.ball.center = newLocation;
+ self.ball.center = [self createRandomLocationFor:self.ball.center];
} completion:^(BOOL b) {
+ NSLog(@"completed");
}];
}
+-(void)onTouch:(UIGestureRecognizer *)sender
+{
+ [self moveBallToRandomLocation];
+ self.score += 2;
+ self.scoreLabel.text = [NSString stringWithFormat:@"%d", self.score];
+}
+
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
diff --git a/Wobble/en.lproj/ViewController.xib b/Wobble/en.lproj/ViewController.xib
index 89348e1..122f9d7 100644
--- a/Wobble/en.lproj/ViewController.xib
+++ b/Wobble/en.lproj/ViewController.xib
@@ -11,7 +11,6 @@
<string key="NS.object.0">2083</string>
</object>
<array key="IBDocument.IntegratedClassDependencies">
- <string>IBNSLayoutConstraint</string>
<string>IBProxyObject</string>
<string>IBUILabel</string>
<string>IBUIView</string>
@@ -36,26 +35,26 @@
<reference key="NSNextResponder"/>
<int key="NSvFlags">274</int>
<array class="NSMutableArray" key="NSSubviews">
- <object class="IBUIView" id="420499551">
+ <object class="IBUIView" id="388009728">
<reference key="NSNextResponder" ref="766721923"/>
<int key="NSvFlags">274</int>
<string key="NSFrame">{{347, 464}, {75, 75}}</string>
<reference key="NSSuperview" ref="766721923"/>
<reference key="NSWindow"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
- <object class="NSColor" key="IBUIBackgroundColor" id="93811976">
+ <object class="NSColor" key="IBUIBackgroundColor" id="349407511">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MCAwIDAAA</bytes>
</object>
<string key="targetRuntimeIdentifier">IBIPadFramework</string>
</object>
- <object class="IBUILabel" id="604058785">
+ <object class="IBUILabel" id="78887338">
<reference key="NSNextResponder" ref="766721923"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{363, 20}, {42, 21}}</string>
<reference key="NSSuperview" ref="766721923"/>
<reference key="NSWindow"/>
- <reference key="NSNextKeyView" ref="420499551"/>
+ <reference key="NSNextKeyView" ref="388009728"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
@@ -88,8 +87,8 @@
<string key="NSFrame">{{0, 20}, {768, 1004}}</string>
<reference key="NSSuperview"/>
<reference key="NSWindow"/>
- <reference key="NSNextKeyView" ref="604058785"/>
- <reference key="IBUIBackgroundColor" ref="93811976"/>
+ <reference key="NSNextKeyView" ref="78887338"/>
+ <reference key="IBUIBackgroundColor" ref="349407511"/>
<object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics">
<int key="IBUIStatusBarStyle">2</int>
</object>
@@ -110,7 +109,7 @@
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">scoreLabel</string>
<reference key="source" ref="841351856"/>
- <reference key="destination" ref="604058785"/>
+ <reference key="destination" ref="78887338"/>
</object>
<int key="connectionID">31</int>
</object>
@@ -118,9 +117,9 @@
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">ball</string>
<reference key="source" ref="841351856"/>
- <reference key="destination" ref="420499551"/>
+ <reference key="destination" ref="388009728"/>
</object>
- <int key="connectionID">32</int>
+ <int key="connectionID">33</int>
</object>
</array>
<object class="IBMutableOrderedSet" key="objectRecords">
@@ -146,170 +145,22 @@
<int key="objectID">2</int>
<reference key="object" ref="766721923"/>
<array class="NSMutableArray" key="children">
- <object class="IBNSLayoutConstraint" id="713875493">
- <reference key="firstItem" ref="420499551"/>
- <int key="firstAttribute">9</int>
- <int key="relation">0</int>
- <reference key="secondItem" ref="604058785"/>
- <int key="secondAttribute">9</int>
- <float key="multiplier">1</float>
- <object class="IBLayoutConstant" key="constant">
- <double key="value">0.0</double>
- </object>
- <float key="priority">1000</float>
- <reference key="containingView" ref="766721923"/>
- <int key="scoringType">6</int>
- <float key="scoringTypeFloat">24</float>
- <int key="contentType">2</int>
- </object>
- <object class="IBNSLayoutConstraint" id="244884741">
- <reference key="firstItem" ref="420499551"/>
- <int key="firstAttribute">5</int>
- <int key="relation">0</int>
- <reference key="secondItem" ref="766721923"/>
- <int key="secondAttribute">5</int>
- <float key="multiplier">1</float>
- <object class="IBLayoutConstant" key="constant">
- <double key="value">347</double>
- </object>
- <float key="priority">1000</float>
- <reference key="containingView" ref="766721923"/>
- <int key="scoringType">3</int>
- <float key="scoringTypeFloat">9</float>
- <int key="contentType">3</int>
- </object>
- <object class="IBNSLayoutConstraint" id="264948237">
- <reference key="firstItem" ref="420499551"/>
- <int key="firstAttribute">9</int>
- <int key="relation">0</int>
- <reference key="secondItem" ref="766721923"/>
- <int key="secondAttribute">9</int>
- <float key="multiplier">1</float>
- <object class="IBLayoutConstant" key="constant">
- <double key="value">0.0</double>
- </object>
- <float key="priority">1000</float>
- <reference key="containingView" ref="766721923"/>
- <int key="scoringType">5</int>
- <float key="scoringTypeFloat">22</float>
- <int key="contentType">2</int>
- </object>
- <object class="IBNSLayoutConstraint" id="848411822">
- <reference key="firstItem" ref="420499551"/>
- <int key="firstAttribute">3</int>
- <int key="relation">0</int>
- <reference key="secondItem" ref="766721923"/>
- <int key="secondAttribute">3</int>
- <float key="multiplier">1</float>
- <object class="IBLayoutConstant" key="constant">
- <double key="value">464</double>
- </object>
- <float key="priority">1000</float>
- <reference key="containingView" ref="766721923"/>
- <int key="scoringType">3</int>
- <float key="scoringTypeFloat">9</float>
- <int key="contentType">3</int>
- </object>
- <object class="IBNSLayoutConstraint" id="281226527">
- <reference key="firstItem" ref="766721923"/>
- <int key="firstAttribute">4</int>
- <int key="relation">0</int>
- <reference key="secondItem" ref="420499551"/>
- <int key="secondAttribute">4</int>
- <float key="multiplier">1</float>
- <object class="IBLayoutConstant" key="constant">
- <double key="value">465</double>
- </object>
- <float key="priority">1000</float>
- <reference key="containingView" ref="766721923"/>
- <int key="scoringType">3</int>
- <float key="scoringTypeFloat">9</float>
- <int key="contentType">3</int>
- </object>
- <object class="IBNSLayoutConstraint" id="839697097">
- <reference key="firstItem" ref="604058785"/>
- <int key="firstAttribute">3</int>
- <int key="relation">0</int>
- <reference key="secondItem" ref="766721923"/>
- <int key="secondAttribute">3</int>
- <float key="multiplier">1</float>
- <object class="IBNSLayoutSymbolicConstant" key="constant">
- <double key="value">20</double>
- </object>
- <float key="priority">1000</float>
- <reference key="containingView" ref="766721923"/>
- <int key="scoringType">8</int>
- <float key="scoringTypeFloat">29</float>
- <int key="contentType">3</int>
- </object>
- <reference ref="420499551"/>
- <reference ref="604058785"/>
+ <reference ref="388009728"/>
+ <reference ref="78887338"/>
</array>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">9</int>
- <reference key="object" ref="420499551"/>
- <reference key="parent" ref="766721923"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">16</int>
- <reference key="object" ref="281226527"/>
- <reference key="parent" ref="766721923"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">17</int>
- <reference key="object" ref="848411822"/>
- <reference key="parent" ref="766721923"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">18</int>
- <reference key="object" ref="264948237"/>
+ <reference key="object" ref="388009728"/>
<reference key="parent" ref="766721923"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">21</int>
- <reference key="object" ref="604058785"/>
- <array class="NSMutableArray" key="children">
- <object class="IBNSLayoutConstraint" id="1051356668">
- <reference key="firstItem" ref="604058785"/>
- <int key="firstAttribute">7</int>
- <int key="relation">0</int>
- <nil key="secondItem"/>
- <int key="secondAttribute">0</int>
- <float key="multiplier">1</float>
- <object class="IBLayoutConstant" key="constant">
- <double key="value">42</double>
- </object>
- <float key="priority">1000</float>
- <reference key="containingView" ref="604058785"/>
- <int key="scoringType">3</int>
- <float key="scoringTypeFloat">9</float>
- <int key="contentType">1</int>
- </object>
- </array>
+ <reference key="object" ref="78887338"/>
+ <array class="NSMutableArray" key="children"/>
<reference key="parent" ref="766721923"/>
</object>
- <object class="IBObjectRecord">
- <int key="objectID">23</int>
- <reference key="object" ref="839697097"/>
- <reference key="parent" ref="766721923"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">25</int>
- <reference key="object" ref="244884741"/>
- <reference key="parent" ref="766721923"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">26</int>
- <reference key="object" ref="713875493"/>
- <reference key="parent" ref="766721923"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">30</int>
- <reference key="object" ref="1051356668"/>
- <reference key="parent" ref="604058785"/>
- </object>
</array>
</object>
<dictionary class="NSMutableDictionary" key="flattenedProperties">
@@ -317,36 +168,16 @@
<string key="-1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="-2.CustomClassName">UIResponder</string>
<string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
- <string key="16.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
- <string key="17.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
- <string key="18.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
- <array class="NSMutableArray" key="2.IBViewMetadataConstraints">
- <reference ref="839697097"/>
- <reference ref="281226527"/>
- <reference ref="848411822"/>
- <reference ref="264948237"/>
- <reference ref="244884741"/>
- <reference ref="713875493"/>
- </array>
<string key="21.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
- <array key="21.IBViewMetadataConstraints">
- <reference ref="1051356668"/>
- </array>
- <boolean value="NO" key="21.IBViewMetadataTranslatesAutoresizingMaskIntoConstraints"/>
- <string key="23.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
- <string key="25.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
- <string key="26.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
- <string key="30.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="9.CustomClassName">Ball</string>
<string key="9.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
- <boolean value="NO" key="9.IBViewMetadataTranslatesAutoresizingMaskIntoConstraints"/>
</dictionary>
<dictionary class="NSMutableDictionary" key="unlocalizedProperties"/>
<nil key="activeLocalization"/>
<dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/>
- <int key="maxID">32</int>
+ <int key="maxID">33</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -359,14 +190,6 @@
</object>
</object>
<object class="IBPartialClassDescription">
- <string key="className">NSLayoutConstraint</string>
- <string key="superclassName">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">./Classes/NSLayoutConstraint.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
<string key="className">ViewController</string>
<string key="superclassName">UIViewController</string>
<dictionary class="NSMutableDictionary" key="outlets">
@@ -394,7 +217,6 @@
<string key="IBDocument.TargetRuntimeIdentifier">IBIPadFramework</string>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
- <bool key="IBDocument.UseAutolayout">YES</bool>
<string key="IBCocoaTouchPluginVersion">2083</string>
</data>
</archive>
diff --git a/Wobble/main.m b/Wobble/main.m
index 6278bc5..c93c3ee 100644
--- a/Wobble/main.m
+++ b/Wobble/main.m
@@ -1,11 +1,3 @@
-//
-// main.m
-// Wobble
-//
-// Created by mo khan on 2013-06-12.
-// Copyright (c) 2013 mo khan. All rights reserved.
-//
-
#import <UIKit/UIKit.h>
#import "AppDelegate.h"