Permalink
Browse files

good progress on filling in views. Pinchy scrollview works and tablev…

…iew+detailview for players
  • Loading branch information...
1 parent 1d3d452 commit ffc61ddade60e6de82416ba3fb898873ca416572 @chrishamant committed May 2, 2009
@@ -8,8 +8,9 @@
#import <UIKit/UIKit.h>
-@interface BoardScreen : UIViewController {
+@interface BoardScreen : UIViewController<UIScrollViewDelegate> {
IBOutlet UIImageView* board;
+ IBOutlet UIScrollView* scrollview;
}
@end
@@ -24,7 +24,10 @@ - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
[super viewDidLoad];
-
+ [scrollview setContentSize:CGSizeMake(board.frame.size.width, board.frame.size.height)];
+ scrollview.maximumZoomScale = 4.0;
+ scrollview.minimumZoomScale = .50;
+ [scrollview addSubview:board];
}
@@ -65,4 +68,8 @@ - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
NSLog(@"end!");
}
+-(UIView*)viewForZoomingInScrollView:(UIScrollView*)scroll{
+ return board;
+}
+
@end
@@ -8,7 +8,8 @@
<string key="IBDocument.HIToolboxVersion">353.00</string>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="5"/>
+ <integer value="14"/>
+ <integer value="22"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -31,59 +32,67 @@
<object class="IBProxyObject" id="975951072">
<string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
</object>
- <object class="IBUIView" id="191373211">
+ <object class="IBUIScrollView" id="494579778">
+ <reference key="NSNextResponder"/>
+ <int key="NSvFlags">268</int>
+ <string key="NSFrameSize">{320, 480}</string>
+ <reference key="NSSuperview"/>
+ <bool key="IBUIAutoresizesSubviews">NO</bool>
+ <bool key="IBUIMultipleTouchEnabled">YES</bool>
+ <bool key="IBUIBounces">NO</bool>
+ <float key="IBUIMinimumZoomScale">2.500000e-01</float>
+ <float key="IBUIMaximumZoomScale">4.000000e+00</float>
+ <bool key="IBUIBouncesZoom">NO</bool>
+ </object>
+ <object class="IBUIImageView" id="531751574">
<reference key="NSNextResponder"/>
<int key="NSvFlags">292</int>
- <object class="NSMutableArray" key="NSSubviews">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBUIImageView" id="27805974">
- <reference key="NSNextResponder" ref="191373211"/>
- <int key="NSvFlags">274</int>
- <string key="NSFrameSize">{320, 460}</string>
- <reference key="NSSuperview" ref="191373211"/>
- <object class="NSColor" key="IBUIBackgroundColor">
- <int key="NSColorSpace">1</int>
- <bytes key="NSRGB">MCAwIDAAA</bytes>
- </object>
- <bool key="IBUIClearsContextBeforeDrawing">NO</bool>
- <int key="IBUIContentMode">1</int>
- <bool key="IBUIMultipleTouchEnabled">YES</bool>
- <object class="NSCustomResource" key="IBUIImage">
- <string key="NSClassName">NSImage</string>
- <string key="NSResourceName">Monopoly Board.jpg</string>
- </object>
- </object>
- </object>
- <string key="NSFrameSize">{320, 460}</string>
+ <string key="NSFrameSize">{500, 500}</string>
<reference key="NSSuperview"/>
- <object class="NSColor" key="IBUIBackgroundColor">
- <int key="NSColorSpace">3</int>
- <bytes key="NSWhite">MQA</bytes>
- <object class="NSColorSpace" key="NSCustomColorSpace">
- <int key="NSID">2</int>
- </object>
+ <bool key="IBUIOpaque">NO</bool>
+ <bool key="IBUIClearsContextBeforeDrawing">NO</bool>
+ <int key="IBUIContentMode">1</int>
+ <bool key="IBUIUserInteractionEnabled">NO</bool>
+ <object class="NSCustomResource" key="IBUIImage">
+ <string key="NSClassName">NSImage</string>
+ <string key="NSResourceName">Monopoly Board.jpg</string>
</object>
- <object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
</object>
</object>
<object class="IBObjectContainer" key="IBDocument.Objects">
<object class="NSMutableArray" key="connectionRecords">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">delegate</string>
+ <reference key="source" ref="494579778"/>
+ <reference key="destination" ref="372490531"/>
+ </object>
+ <int key="connectionID">17</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">scrollview</string>
+ <reference key="source" ref="372490531"/>
+ <reference key="destination" ref="494579778"/>
+ </object>
+ <int key="connectionID">18</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">view</string>
<reference key="source" ref="372490531"/>
- <reference key="destination" ref="191373211"/>
+ <reference key="destination" ref="494579778"/>
</object>
- <int key="connectionID">3</int>
+ <int key="connectionID">20</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">board</string>
<reference key="source" ref="372490531"/>
- <reference key="destination" ref="27805974"/>
+ <reference key="destination" ref="531751574"/>
</object>
- <int key="connectionID">6</int>
+ <int key="connectionID">23</int>
</object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
@@ -98,15 +107,6 @@
<nil key="parent"/>
</object>
<object class="IBObjectRecord">
- <int key="objectID">1</int>
- <reference key="object" ref="191373211"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="27805974"/>
- </object>
- <reference key="parent" ref="71017740"/>
- </object>
- <object class="IBObjectRecord">
<int key="objectID">-1</int>
<reference key="object" ref="372490531"/>
<reference key="parent" ref="71017740"/>
@@ -118,9 +118,17 @@
<reference key="parent" ref="71017740"/>
</object>
<object class="IBObjectRecord">
- <int key="objectID">5</int>
- <reference key="object" ref="27805974"/>
- <reference key="parent" ref="191373211"/>
+ <int key="objectID">14</int>
+ <reference key="object" ref="494579778"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ <reference key="parent" ref="71017740"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">22</int>
+ <reference key="object" ref="531751574"/>
+ <reference key="parent" ref="71017740"/>
</object>
</object>
</object>
@@ -130,16 +138,18 @@
<bool key="EncodedWithXMLCoder">YES</bool>
<string>-1.CustomClassName</string>
<string>-2.CustomClassName</string>
- <string>1.IBEditorWindowLastContentRect</string>
- <string>1.IBPluginDependency</string>
- <string>5.IBPluginDependency</string>
+ <string>14.IBEditorWindowLastContentRect</string>
+ <string>14.IBPluginDependency</string>
+ <string>22.IBEditorWindowLastContentRect</string>
+ <string>22.IBPluginDependency</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>BoardScreen</string>
<string>UIResponder</string>
- <string>{{364, 355}, {320, 480}}</string>
+ <string>{{483, 342}, {320, 480}}</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string>{{21, 322}, {500, 500}}</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</object>
</object>
@@ -163,7 +173,7 @@
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">6</int>
+ <int key="maxID">23</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -172,8 +182,17 @@
<string key="className">BoardScreen</string>
<string key="superclassName">UIViewController</string>
<object class="NSMutableDictionary" key="outlets">
- <string key="NS.key.0">board</string>
- <string key="NS.object.0">UIImageView</string>
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSMutableArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>board</string>
+ <string>scrollview</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>UIImageView</string>
+ <string>UIScrollView</string>
+ </object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
@@ -185,5 +204,6 @@
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.LastKnownRelativeProjectPath">../Monopoly.xcodeproj</string>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
+ <string key="IBCocoaTouchPluginVersion">3.0</string>
</data>
</archive>
@@ -30,6 +30,7 @@ typedef struct{
-(void)playerTakeTurn;
@property(retain) GameBoard* board;
+@property(retain) NSArray* players;
@property(retain,readonly) Player* currentPlayer;
@end
@@ -10,6 +10,7 @@ @implementation GameController
@synthesize board;
@synthesize currentPlayer;
+@synthesize players;
-(Roll)rollDice{
Roll roll;
@@ -19,7 +19,7 @@ -(void)startMonopoly:(GameController*)aGame{
[NSArray arrayWithObjects:
[[[GameScreen alloc] initWithGame:aGame] autorelease],
[[[BoardScreen alloc] initWithNibName:@"BoardScreen" bundle:nil] autorelease],
- [[[PlayersScreen alloc] initWithNibName:@"PlayersScreen" bundle:nil] autorelease],
+ [[[PlayersScreen alloc] initWithPlayers:aGame.players] autorelease],
nil]];
[tab setSelectedIndex:0];
@@ -0,0 +1,21 @@
+//
+// PlayerScreenDetail.h
+// Monopoly
+//
+// Created by Chris Hamant on 5/2/09.
+// Copyright 2009 __MyCompanyName__. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+@class Player;
+
+@interface PlayerScreenDetail : UIViewController {
+ Player* player;
+ IBOutlet UILabel* titleLabel;
+ IBOutlet UILabel* spaceLabel;
+}
+
+- (id)initWithPlayer:(Player*)p;
+
+@property(retain,nonatomic) Player* player;
+@end
@@ -0,0 +1,58 @@
+//
+// PlayerScreenDetail.m
+// Monopoly
+//
+// Created by Chris Hamant on 5/2/09.
+// Copyright 2009 __MyCompanyName__. All rights reserved.
+//
+
+#import "PlayerScreenDetail.h"
+#import "Player.h"
+@class GameBoardSpace;
+
+@implementation PlayerScreenDetail
+@synthesize player;
+
+ // The designated initializer. Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
+- (id)initWithPlayer:(Player*)p {
+ if (self = [super initWithNibName:@"PlayerScreenDetail" bundle:nil]) {
+ [self setPlayer:p];
+ }
+ return self;
+}
+
+
+
+// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
+- (void)viewDidLoad {
+ [super viewDidLoad];
+ titleLabel.text = player.title;
+ spaceLabel.text = player.currentSpace.title;
+}
+
+-(void)viewWillAppear{
+ NSLog(@"the view is appearings!");
+}
+
+- (void)didReceiveMemoryWarning {
+ // Releases the view if it doesn't have a superview.
+ [super didReceiveMemoryWarning];
+
+ // Release any cached data, images, etc that aren't in use.
+}
+
+- (void)viewDidUnload {
+ // Release any retained subviews of the main view.
+ // e.g. self.myOutlet = nil;
+}
+
+
+- (void)dealloc {
+ [super dealloc];
+ [player release];
+ [titleLabel release];
+ [spaceLabel release];
+}
+
+
+@end
Oops, something went wrong.

0 comments on commit ffc61dd

Please sign in to comment.