# HG changeset patch
# User koda
# Date 1318122285 -7200
# Node ID f6726ec81e64869c0e7c0c71f74dff9b362331fb
# Parent 7a8da11a61440b559fa3a2f924bbb80a0dc06c73
finally removed the white border glitch of the ipad preview map, moved initialization from IB to code
diff -r 7a8da11a6144 -r f6726ec81e64 project_files/HedgewarsMobile/Classes/MapConfigViewController-iPad.xib
--- a/project_files/HedgewarsMobile/Classes/MapConfigViewController-iPad.xib Sun Oct 09 01:45:12 2011 +0200
+++ b/project_files/HedgewarsMobile/Classes/MapConfigViewController-iPad.xib Sun Oct 09 03:04:45 2011 +0200
@@ -117,38 +117,6 @@
0.05000000074505806
0.05000000074505806
-
292
@@ -246,13 +214,23 @@
IBIPadFramework
0
0
-
-
+
+ Helvetica-Bold
+ 15
+ 16
+
+
+ 3
+ MQA
+
1
MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA
-
+
+ 3
+ MC41AA
+
NSImage
startGameButton.png
@@ -327,14 +305,6 @@
- previewButton
-
-
-
- 13
-
-
-
maxLabel
@@ -443,23 +413,6 @@
77
-
-
- mapButtonPressed
-
-
- 7
-
- 113
-
-
-
- delegate
-
-
-
- 114
-
@@ -490,7 +443,6 @@
-
@@ -536,11 +488,6 @@
- 9
-
-
-
-
8
@@ -581,8 +528,6 @@
75.IBPluginDependency
75.IBViewBoundsToFrameTransform
8.IBPluginDependency
- 9.CustomClassName
- 9.IBPluginDependency
YES
@@ -618,8 +563,6 @@
P4AAAL+AAABEbsAAxDzAAA
com.apple.InterfaceBuilder.IBCocoaTouchPlugin
- MapPreviewButtonView
- com.apple.InterfaceBuilder.IBCocoaTouchPlugin
diff -r 7a8da11a6144 -r f6726ec81e64 project_files/HedgewarsMobile/Classes/MapConfigViewController-iPhone.xib
--- a/project_files/HedgewarsMobile/Classes/MapConfigViewController-iPhone.xib Sun Oct 09 01:45:12 2011 +0200
+++ b/project_files/HedgewarsMobile/Classes/MapConfigViewController-iPhone.xib Sun Oct 09 03:04:45 2011 +0200
@@ -12,6 +12,7 @@
YES
+
YES
@@ -46,7 +47,6 @@
292
{480, 276}
-
NO
IBCocoaTouchFramework
@@ -59,7 +59,6 @@
292
{{9, 14}, {270, 30}}
-
NO
IBCocoaTouchFramework
2
@@ -110,7 +109,6 @@
292
{{119, 207}, {149, 23}}
-
NO
IBCocoaTouchFramework
0
@@ -123,7 +121,6 @@
292
{{16, 58}, {256, 128}}
-
NO
IBCocoaTouchFramework
0
@@ -151,7 +148,6 @@
292
{{58, 221}, {48, 35}}
-
NO
YES
7
@@ -177,7 +173,6 @@
292
{{109, 237}, {169, 29}}
-
NO
YES
7
@@ -203,7 +198,6 @@
274
{{284, 0}, {196, 276}}
-
3
MCAwAA
@@ -226,7 +220,6 @@
292
{{-9, 225}, {92, 27}}
-
NO
YES
7
@@ -247,7 +240,6 @@
{480, 276}
-
@@ -359,15 +351,6 @@
32
-
- mapButtonPressed
-
-
- 7
-
- 33
-
-
delegate
@@ -375,6 +358,15 @@
34
+
+
+ mapButtonPressed:
+
+
+ 7
+
+ 37
+
@@ -534,7 +526,7 @@
- 36
+ 37
@@ -547,7 +539,7 @@
YES
buttonPressed:
- mapButtonPressed
+ mapButtonPressed:
segmentedControlChanged:
sliderChanged:
sliderEndedChanging:
@@ -566,7 +558,7 @@
YES
buttonPressed:
- mapButtonPressed
+ mapButtonPressed:
segmentedControlChanged:
sliderChanged:
sliderEndedChanging:
@@ -578,7 +570,7 @@
id
- mapButtonPressed
+ mapButtonPressed:
id
@@ -681,11 +673,15 @@
UILabel
-
+
IBProjectSource
Classes/HWUtils.h
+
+ UITableView
+
+
YES
diff -r 7a8da11a6144 -r f6726ec81e64 project_files/HedgewarsMobile/Classes/MapConfigViewController.h
--- a/project_files/HedgewarsMobile/Classes/MapConfigViewController.h Sun Oct 09 01:45:12 2011 +0200
+++ b/project_files/HedgewarsMobile/Classes/MapConfigViewController.h Sun Oct 09 03:04:45 2011 +0200
@@ -84,7 +84,7 @@
-(IBAction) buttonPressed:(id) sender;
--(IBAction) mapButtonPressed;
+-(IBAction) mapButtonPressed:(id) sender;
-(IBAction) sliderChanged:(id) sender;
-(IBAction) sliderEndedChanging:(id) sender;
-(IBAction) segmentedControlChanged:(id) sender;
diff -r 7a8da11a6144 -r f6726ec81e64 project_files/HedgewarsMobile/Classes/MapConfigViewController.m
--- a/project_files/HedgewarsMobile/Classes/MapConfigViewController.m Sun Oct 09 01:45:12 2011 +0200
+++ b/project_files/HedgewarsMobile/Classes/MapConfigViewController.m Sun Oct 09 03:04:45 2011 +0200
@@ -38,7 +38,7 @@
return rotationManager(interfaceOrientation);
}
--(IBAction) mapButtonPressed {
+-(IBAction) mapButtonPressed:(id) sender {
[AudioManagerController playClickSound];
[self updatePreview];
}
@@ -57,19 +57,16 @@
[seedCmd release];
NSArray *source = [self.dataSourceArray objectAtIndex:scIndex];
- NSIndexPath *theIndex;
if (isRandomness()) {
// prevent other events and add an activity while the preview is beign generated
[self turnOffWidgets];
[self.previewButton updatePreviewWithSeed:seed];
- theIndex = [NSIndexPath indexPathForRow:(random()%[source count]) inSection:0];
- } else {
- theIndex = [NSIndexPath indexPathForRow:(random()%[source count]) inSection:0];
// the preview for static maps is loaded in didSelectRowAtIndexPath
}
[seed release];
// perform as if user clicked on an entry
+ NSIndexPath *theIndex = [NSIndexPath indexPathForRow:(random()%[source count]) inSection:0];
[self tableView:self.tableView didSelectRowAtIndexPath:theIndex];
if (IS_NOT_POWERFUL([HWUtils modelType]) == NO)
[self.tableView scrollToRowAtIndexPath:theIndex atScrollPosition:UITableViewScrollPositionMiddle animated:YES];
@@ -413,6 +410,18 @@
return dataSourceArray;
}
+-(MapPreviewButtonView *)previewButton {
+ if (previewButton == nil) {
+ MapPreviewButtonView *preview = [[MapPreviewButtonView alloc] initWithFrame:CGRectMake(736, 26, 256, 128)];
+ preview.delegate = self;
+ [preview addTarget:self action:@selector(mapButtonPressed:) forControlEvents:UIControlEventTouchUpInside];
+ [self.view addSubview:preview];
+ self.previewButton = preview;
+ [preview release];
+ }
+ return previewButton;
+}
+
-(void) viewDidLoad {
[super viewDidLoad];
@@ -488,6 +497,7 @@
-(void) didReceiveMemoryWarning {
self.dataSourceArray = nil;
+ self.previewButton = nil;
[super didReceiveMemoryWarning];
if (self.view.superview == nil) {
diff -r 7a8da11a6144 -r f6726ec81e64 project_files/HedgewarsMobile/Classes/MapPreviewButtonView.h
--- a/project_files/HedgewarsMobile/Classes/MapPreviewButtonView.h Sun Oct 09 01:45:12 2011 +0200
+++ b/project_files/HedgewarsMobile/Classes/MapPreviewButtonView.h Sun Oct 09 03:04:45 2011 +0200
@@ -38,9 +38,8 @@
@property (nonatomic,assign) id delegate;
--(void) setBackgroundImageRounded:(UIImage *)image forState:(UIControlState)state;
--(void) setImageRounded:(UIImage *)image forState:(UIControlState)state;
--(void) setImageRoundedForNormalState:(UIImage *)image;
+-(void) setImageRounded:(UIImage *)image forState:(UIControlState) controlState;
+-(void) setImageRounded:(UIImage *)image;
-(void) updatePreviewWithSeed:(NSString *)seed;
-(void) updatePreviewWithFile:(NSString *)filePath;
-(void) turnOnWidgets;
diff -r 7a8da11a6144 -r f6726ec81e64 project_files/HedgewarsMobile/Classes/MapPreviewButtonView.m
--- a/project_files/HedgewarsMobile/Classes/MapPreviewButtonView.m Sun Oct 09 01:45:12 2011 +0200
+++ b/project_files/HedgewarsMobile/Classes/MapPreviewButtonView.m Sun Oct 09 03:04:45 2011 +0200
@@ -24,6 +24,8 @@
#import "UIImageExtra.h"
#import "ServerSetup.h"
#import
+#import
+
#define INDICATOR_TAG 7654
@@ -33,15 +35,8 @@
-(id) initWithFrame:(CGRect)frame {
if ((self = [super initWithFrame:frame])) {
delegate = nil;
- [self setBackgroundImageRounded:[UIImage whiteImage:frame.size] forState:UIControlStateNormal];
- }
- return self;
-}
-
--(id) initWithCoder:(NSCoder *)aDecoder {
- if ((self = [super initWithCoder:aDecoder])) {
- delegate = nil;
- [self setBackgroundImageRounded:[UIImage whiteImage:self.frame.size] forState:UIControlStateNormal];
+ self.backgroundColor = [UIColor whiteColor];
+ self.layer.cornerRadius = 12;
}
return self;
}
@@ -53,16 +48,11 @@
#pragma mark -
#pragma mark image wrappers
--(void) setBackgroundImageRounded:(UIImage *)image forState:(UIControlState)state {
- // TODO:http://stackoverflow.com/questions/4272476/setbackgroundimage-behaviour-changed-on-ipad-4-2
- [self setBackgroundImage:[image makeRoundCornersOfSize:CGSizeMake(12, 12)] forState:state];
+-(void) setImageRounded:(UIImage *)image forState:(UIControlState)controlState {
+ [self setImage:[image makeRoundCornersOfSize:CGSizeMake(12, 12)] forState:controlState];
}
--(void) setImageRounded:(UIImage *)image forState:(UIControlState)state {
- [self setImage:[image makeRoundCornersOfSize:CGSizeMake(12, 12)] forState:state];
-}
-
--(void) setImageRoundedForNormalState:(UIImage *)image {
+-(void) setImageRounded:(UIImage *)image {
[self setImageRounded:image forState:UIControlStateNormal];
}
@@ -163,7 +153,7 @@
previewCGImage = nil;
// all these are performed on the main thread to prevent a leak
- [self performSelectorOnMainThread:@selector(setImageRoundedForNormalState:)
+ [self performSelectorOnMainThread:@selector(setImageRounded:)
withObject:previewImage
waitUntilDone:NO];
[previewImage release];