Kaydet (Commit) 4219195d authored tarafından Ptyl Dragon's avatar Ptyl Dragon Kaydeden (comit) Tor Lillqvist

ios tile testing app done

Change-Id: I1c4a45c3f19d79b4da8cc96304e0e1802f92dff2
Reviewed-on: https://gerrit.libreoffice.org/6320Reviewed-by: 's avatarTor Lillqvist <tml@collabora.com>
Tested-by: 's avatarTor Lillqvist <tml@collabora.com>
üst 4d8f12f5
......@@ -1542,6 +1542,7 @@
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = "";
SDKROOT = iphoneos;
STRIP_INSTALLED_PRODUCT = NO;
TARGETED_DEVICE_FAMILY = "1,2";
VALID_ARCHS = armv7;
};
......@@ -1582,6 +1583,7 @@
OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
OTHER_LDFLAGS = "";
SDKROOT = iphoneos;
STRIP_INSTALLED_PRODUCT = NO;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
VALID_ARCHS = armv7;
......@@ -1591,6 +1593,7 @@
689EBB0E18069FB8002F1CD7 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
DEBUG_INFORMATION_FORMAT = dwarf;
GCC_DYNAMIC_NO_PIC = NO;
GCC_INPUT_FILETYPE = sourcecode.cpp.objcpp;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
......@@ -1669,6 +1672,7 @@
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = "";
SDKROOT = iphoneos;
STRIP_INSTALLED_PRODUCT = NO;
TARGETED_DEVICE_FAMILY = "1,2";
VALID_ARCHS = armv7;
};
......@@ -1677,6 +1681,7 @@
88A13310181023A40091F25E /* Debug_tile_tester */ = {
isa = XCBuildConfiguration;
buildSettings = {
DEBUG_INFORMATION_FORMAT = dwarf;
GCC_DYNAMIC_NO_PIC = NO;
GCC_INPUT_FILETYPE = sourcecode.cpp.objcpp;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
......
......@@ -48,9 +48,11 @@
889B7929180FF928005A3149 /* MLOAppRoleLoApp.m in Sources */ = {isa = PBXBuildFile; fileRef = 889B7928180FF928005A3149 /* MLOAppRoleLoApp.m */; };
889B792C180FF967005A3149 /* MLOAppRoleTileTester.m in Sources */ = {isa = PBXBuildFile; fileRef = 889B792B180FF967005A3149 /* MLOAppRoleTileTester.m */; };
889B7930180FFBA5005A3149 /* MLOAppRoleBase.m in Sources */ = {isa = PBXBuildFile; fileRef = 889B792F180FFBA5005A3149 /* MLOAppRoleBase.m */; };
88A083BA18115E8D009C75BE /* MLOTestingTile.m in Sources */ = {isa = PBXBuildFile; fileRef = 88A083B918115E8D009C75BE /* MLOTestingTile.m */; };
88A132FC181020320091F25E /* MLOTestingTileRendererViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 88A132FB181020320091F25E /* MLOTestingTileRendererViewController.m */; };
88A132FF1810204E0091F25E /* MLOTestingTileParametersViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 88A132FE1810204E0091F25E /* MLOTestingTileParametersViewController.m */; };
88A1330B1810213F0091F25E /* MLOAppRoleFactory.m in Sources */ = {isa = PBXBuildFile; fileRef = 88A1330A1810213E0091F25E /* MLOAppRoleFactory.m */; };
88A13318181040BC0091F25E /* MLOTestingTileParameter.m in Sources */ = {isa = PBXBuildFile; fileRef = 88A13317181040BC0091F25E /* MLOTestingTileParameter.m */; };
88A2ED23180D4D7C009F39C0 /* MLOKeyboardManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 88A2ED22180D4D7C009F39C0 /* MLOKeyboardManager.m */; };
/* End PBXBuildFile section */
......@@ -157,6 +159,8 @@
889B792E180FFBA5005A3149 /* MLOAppRoleBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MLOAppRoleBase.h; path = role/MLOAppRoleBase.h; sourceTree = "<group>"; };
889B792F180FFBA5005A3149 /* MLOAppRoleBase.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MLOAppRoleBase.m; path = role/MLOAppRoleBase.m; sourceTree = "<group>"; };
889B793618101709005A3149 /* MLOAppRoleProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = MLOAppRoleProtocol.h; path = role/MLOAppRoleProtocol.h; sourceTree = "<group>"; };
88A083B818115E8D009C75BE /* MLOTestingTile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MLOTestingTile.h; path = testing_tiles/MLOTestingTile.h; sourceTree = "<group>"; };
88A083B918115E8D009C75BE /* MLOTestingTile.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MLOTestingTile.m; path = testing_tiles/MLOTestingTile.m; sourceTree = "<group>"; };
88A132FA181020320091F25E /* MLOTestingTileRendererViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MLOTestingTileRendererViewController.h; path = testing_tiles/MLOTestingTileRendererViewController.h; sourceTree = "<group>"; };
88A132FB181020320091F25E /* MLOTestingTileRendererViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MLOTestingTileRendererViewController.m; path = testing_tiles/MLOTestingTileRendererViewController.m; sourceTree = "<group>"; };
88A132FD1810204E0091F25E /* MLOTestingTileParametersViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MLOTestingTileParametersViewController.h; path = testing_tiles/MLOTestingTileParametersViewController.h; sourceTree = "<group>"; };
......@@ -164,6 +168,8 @@
88A13300181020E40091F25E /* MLOTestingTileSubviewControllerProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = MLOTestingTileSubviewControllerProtocol.h; path = testing_tiles/MLOTestingTileSubviewControllerProtocol.h; sourceTree = "<group>"; };
88A133091810213E0091F25E /* MLOAppRoleFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MLOAppRoleFactory.h; path = role/MLOAppRoleFactory.h; sourceTree = "<group>"; };
88A1330A1810213E0091F25E /* MLOAppRoleFactory.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MLOAppRoleFactory.m; path = role/MLOAppRoleFactory.m; sourceTree = "<group>"; };
88A13316181040BC0091F25E /* MLOTestingTileParameter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MLOTestingTileParameter.h; sourceTree = "<group>"; };
88A13317181040BC0091F25E /* MLOTestingTileParameter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MLOTestingTileParameter.m; sourceTree = "<group>"; };
88A2ED21180D4D7C009F39C0 /* MLOKeyboardManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MLOKeyboardManager.h; sourceTree = "<group>"; };
88A2ED22180D4D7C009F39C0 /* MLOKeyboardManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MLOKeyboardManager.m; sourceTree = "<group>"; };
88E94760180D4E9800771808 /* MLOToolbarViewController_Impl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MLOToolbarViewController_Impl.h; sourceTree = "<group>"; };
......@@ -405,8 +411,12 @@
children = (
88A132FA181020320091F25E /* MLOTestingTileRendererViewController.h */,
88A132FB181020320091F25E /* MLOTestingTileRendererViewController.m */,
88A083B818115E8D009C75BE /* MLOTestingTile.h */,
88A083B918115E8D009C75BE /* MLOTestingTile.m */,
88A132FD1810204E0091F25E /* MLOTestingTileParametersViewController.h */,
88A132FE1810204E0091F25E /* MLOTestingTileParametersViewController.m */,
88A13316181040BC0091F25E /* MLOTestingTileParameter.h */,
88A13317181040BC0091F25E /* MLOTestingTileParameter.m */,
88A13300181020E40091F25E /* MLOTestingTileSubviewControllerProtocol.h */,
);
name = testing_tiles;
......@@ -504,6 +514,8 @@
88A132FC181020320091F25E /* MLOTestingTileRendererViewController.m in Sources */,
88A132FF1810204E0091F25E /* MLOTestingTileParametersViewController.m in Sources */,
88A1330B1810213F0091F25E /* MLOAppRoleFactory.m in Sources */,
88A13318181040BC0091F25E /* MLOTestingTileParameter.m in Sources */,
88A083BA18115E8D009C75BE /* MLOTestingTile.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -524,6 +536,7 @@
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
......@@ -547,6 +560,7 @@
LLVM_LTO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
STRIP_INSTALLED_PRODUCT = NO;
};
name = Debug;
};
......@@ -581,6 +595,7 @@
LINK_WITH_STANDARD_LIBRARIES = NO;
LLVM_LTO = YES;
SDKROOT = iphoneos;
STRIP_INSTALLED_PRODUCT = NO;
VALIDATE_PRODUCT = YES;
};
name = Release;
......@@ -633,6 +648,7 @@
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
......@@ -656,6 +672,7 @@
LLVM_LTO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
STRIP_INSTALLED_PRODUCT = NO;
};
name = Debug_tile_tester;
};
......
......@@ -82,6 +82,7 @@ static const CGFloat
self.view.frame.size.width,
self.view.frame.size.height - TOP_BAR_HEIGHT);
self.canvas = [[UIView alloc] initWithFrame:canvasRect];
self.role.view = self.canvas;
self.canvas.clipsToBounds = YES;
self.canvas.backgroundColor = [UIColor whiteColor];
}
......
// -*- Mode: Objective-C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
//
// This file is part of the LibreOffice project.
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
#import "MLOObject.h"
typedef void (^MLOTestingTileParameterExtractor)(CGFloat value);
@class MLOTestingTileParametersViewController;
@interface MLOTestingTileParameter : MLOObject
-(MLOTestingTileParameter *)initWithParams:(MLOTestingTileParametersViewController *) params label:(NSString *)label extractor:(MLOTestingTileParameterExtractor) extractor defaultValue:(NSInteger) defaultValue;
-(void)extract;
-(void)setParamFrame:(CGRect) paramFrame;
-(void)addToSuperview;
@end
// -*- Mode: Objective-C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
//
// This file is part of the LibreOffice project.
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
#import "MLOTestingTileParameter.h"
#import "MLOTestingTileParametersViewController.h"
@interface MLOTestingTileParameter ()
@property MLOTestingTileParametersViewController * params;
@property (nonatomic,strong) MLOTestingTileParameterExtractor extractor;
@property UILabel * label;
@property UITextField * data;
@property NSInteger defaultValue;
@end
@implementation MLOTestingTileParameter
-(MLOTestingTileParameter *)initWithParams:(MLOTestingTileParametersViewController *) params label:(NSString *)label extractor:(MLOTestingTileParameterExtractor) extractor defaultValue:(NSInteger) defaultValue{
NSLog(@"Creating tile testing param %@ with default value %d",label,defaultValue);
self = [self init];
if(self){
self.params = params;
self.extractor = extractor;
self.defaultValue = defaultValue;
[self initLabel:label];
[self initTextField];
}
return self;
}
-(NSString *)description{
return [@"MLOTestingTileParameter: " stringByAppendingString:self.label.text];
}
-(void) initLabel:(NSString *) label{
self.label =[[UILabel alloc] initWithFrame:CGRECT_ZERO];
self.label.text = label;
self.label.textAlignment = NSTextAlignmentRight;
}
-(void) initTextField{
self.data = [[UITextField alloc] initWithFrame:CGRECT_ZERO];
[self.data setKeyboardType:UIKeyboardTypeNumberPad];
self.data.textAlignment = NSTextAlignmentLeft;
[self resetValue];
}
-(void)resetValue{
self.data.text = [NSString stringWithFormat:@"%d",self.defaultValue];
}
-(void)setParamFrame:(CGRect) paramFrame{
NSLog(@"%@ setParamFrame",self);
self.label.frame=CGRectMake(paramFrame.origin.x,
paramFrame.origin.y,
paramFrame.size.width/2.0f,
paramFrame.size.height);
self.data.frame =CGRectMake(paramFrame.origin.x + paramFrame.size.width/2.0f,
paramFrame.origin.y,
paramFrame.size.width/2.0f,
paramFrame.size.height);
}
-(void)addToSuperview{
NSLog(@"%@ addToSuperview",self);
[self.params.view addSubview:self.label];
[self.params.view addSubview:self.data];
}
-(void)extract{
NSLog(@"%@ extract",self);
if([[NSNumberFormatter new]numberFromString:self.data.text] == nil){
NSLog(@"%@ got illegal value: %@, reseting to %d",self,self.data.text,self.defaultValue);
[self resetValue];
}
self.extractor([self.data.text floatValue]);
}
@end
......@@ -16,6 +16,8 @@
+(MLOAppRoleBase *) getInstanceWithMainViewController:(MLOMainViewController *) mainViewController{
MLOAppRoleBase * role;
NSLog(@"Creating app role: %@",MLOAppRoleString(APP_ROLE));
switch (APP_ROLE) {
case LO_APP:
{
......
......@@ -20,6 +20,10 @@ static const NSTimeInterval ROTATE_FLASH_DURATION=0.5f;
@implementation MLOAppRoleLoApp
-(NSString *)description{
return @"MLOAppRoleLoApp";
}
-(void)initSubviews{
MLOMainViewController * main = [self mainViewController];
main.scroller = [[MLOScrollerViewController alloc] initWithMainViewController:main];
......
......@@ -7,7 +7,9 @@
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
#import "MLOAppRoleBase.h"
@class MLOTestingTileRendererViewController,MLOTestingTileParametersViewController;
@interface MLOAppRoleTileTester : MLOAppRoleBase
@property MLOTestingTileRendererViewController * renderer;
@property MLOTestingTileParametersViewController * params;
@end
......@@ -12,59 +12,67 @@
#import "MLOTestingTileRendererViewController.h"
#import "MLOTestingTileParametersViewController.h"
@interface MLOAppRoleTileTester ()
@property MLOTestingTileRendererViewController * renderer;
@property MLOTestingTileParametersViewController * params;
@end
@implementation MLOAppRoleTileTester
-(void)initSubviews{
NSLog(@"%@ initSubviews",self);
self.renderer = [[MLOTestingTileRendererViewController alloc] initWithTester:self];
self.params = [[MLOTestingTileParametersViewController alloc] initWithTester:self];
}
-(NSString *)description{
return @"MLOAppRoleTileTester";
}
-(void)setWidth:(CGFloat) width height:(CGFloat) height{
NSLog(@"%@ setWidth:height",self);
if(width > height){
CGFloat halfWidth = width/2.0f;
self.renderer.view.frame =CGRectMake(0, 0, halfWidth, height);
self.params.view.frame =CGRectMake(halfWidth,0, halfWidth, height);
}else{
CGFloat halfHeight = height/2.0f;
self.renderer.view.frame =CGRectMake(0, 0, width, halfHeight);
self.params.view.frame =CGRectMake(width,halfHeight, width, halfHeight);
self.params.view.frame =CGRectMake(0, 0, width, halfHeight);
self.renderer.view.frame =CGRectMake(0,halfHeight, width, halfHeight);
}
[self.renderer resize];
[self.params resize];
}
-(void)addSubviews{
NSLog(@"%@ addSubviews",self);
[self.renderer addToMainViewController];
[self.params addToMainViewController];
[self.renderer addToSuperview];
[self.params addToSuperview];
[self.mainViewController resize];
}
-(void)rotate{
NSLog(@"%@ rotate",self);
MLOMainViewController * main = [self mainViewController];
[main resize];
[main.topbar onRotate];
[self.renderer resize];
[self.params resize];
}
-(void)showLibreOffice{
NSLog(@"%@ showLibreOffice",self);
}
-(void)hideLibreOffice{
NSLog(@"%@ hideLibreOffice",self);
}
-(void)initWindow:(UIWindow *) window{
NSLog(@"%@ initWindow",self);
}
@end
// -*- Mode: Objective-C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
//
// This file is part of the LibreOffice project.
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
#import "MLOSubView.h"
@class MLOAppRoleTileTester;
@interface MLOTestingTile : MLOSubView
-(id)initWithTester:(MLOAppRoleTileTester *) tester;
-(void)resize;
@end
// -*- Mode: Objective-C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
//
// This file is part of the LibreOffice project.
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
#import "MLOTestingTile.h"
#import "MLOTestingTileParametersViewController.h"
#import "MLOTestingTileRendererViewController.h"
#import "MLOAppRoleTileTester.h"
#include <touch/touch.h>
@interface MLOTestingTile ()
@property MLOAppRoleTileTester * tester;
@end
@implementation MLOTestingTile
-(id)initWithTester:(MLOAppRoleTileTester *)tester{
self = [self initWithFrame:[MLOTestingTile resized:tester]];
if(self){
self.tester =tester;
self.backgroundColor =[UIColor greenColor];
}
return self;
}
+(CGRect)resized:(MLOAppRoleTileTester *)tester{
return CGRectMake( (tester.renderer.view.frame.size.width -tester.params.contextWidth)/2.0f,
(tester.renderer.view.frame.size.height -tester.params.contextHeight)/2.0f,
tester.params.contextWidth,
tester.params.contextHeight);
}
-(void)resize{
self.frame = [MLOTestingTile resized:self.tester];
}
- (void)drawRect:(CGRect)rect
{
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSaveGState(context);
CGContextTranslateCTM(context, 0, self.tester.params.contextHeight);
CGContextScaleCTM(context, 1, -1);
CGContextScaleCTM(context, 1, 1);
touch_lo_draw_tile(context,
self.tester.params.contextWidth,
self.tester.params.contextHeight,
self.tester.params.tilePosX,
self.tester.params.tilePosY,
self.tester.params.tileWidth,
self.tester.params.tileHeight);
CGContextRestoreGState(context);
}
@end
......@@ -10,5 +10,5 @@
#import "MLOTestingTileSubviewControllerProtocol.h"
@interface MLOTestingTileParametersViewController : MLOViewController<MLOTestingTileSubviewControllerProtocol>
@property CGFloat contextWidth, contextHeight, tilePosX, tilePosY, tileWidth, tileHeight;
@end
......@@ -7,9 +7,16 @@
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
#import "MLOTestingTileParametersViewController.h"
#import "MLOTestingTileParameter.h"
#import "MLOAppRoleTileTester.h"
#import "MLOTestingTileRendererViewController.h"
static const CGFloat RENDER_BUTTON_HEIGHT = 50.0f;
@interface MLOTestingTileParametersViewController ()
@property MLOAppRoleTileTester * tester;
@property NSArray * params;
@property UIButton * renderButton;
@end
@implementation MLOTestingTileParametersViewController
......@@ -18,14 +25,81 @@
self = [self init];
if(self){
self.tester = tester;
[self initParams];
[self initRenderButton];
}
NSLog(@"%@ initWithTester",self);
return self;
}
-(NSString *)description{
return @"MLOTestingTileParametersViewController";
}
-(void)initParams{
self.params = @[[self createParam:@"contextWidth" extractor:^(CGFloat value){self.contextWidth = value;} value:100],
[self createParam:@"contextHeight" extractor:^(CGFloat value){self.contextHeight = value;} value:100],
[self createParam:@"tilePosX" extractor:^(CGFloat value){self.tilePosX = value;} value:0],
[self createParam:@"tilePosY" extractor:^(CGFloat value){self.tilePosY = value;} value:0],
[self createParam:@"tileWidth" extractor:^(CGFloat value){self.tileWidth = value;} value:100],
[self createParam:@"tileHeight" extractor:^(CGFloat value){self.tileHeight = value;} value:100]
];
}
-(void)initRenderButton{
UIButton * button =[UIButton buttonWithType:UIButtonTypeRoundedRect];
[button addTarget:self action:@selector(renderTile) forControlEvents:UIControlEventTouchDown];
[button setTitle:@"Render Tile" forState:UIControlStateNormal];
self.renderButton =button;
}
-(MLOTestingTileParameter *) createParam:(NSString *)name extractor:(MLOTestingTileParameterExtractor) extractor value:(CGFloat)defaultValue{
return [[MLOTestingTileParameter alloc] initWithParams:self label:name extractor:extractor defaultValue:defaultValue];
}
-(void)resize{
NSLog(@"%@ resize",self);
CGFloat height = self.view.frame.size.height;
CGFloat width = self.view.frame.size.width;
if(width<height){
height = height/2.0f;
}
CGFloat heightWithoutButton = height - RENDER_BUTTON_HEIGHT;
CGFloat paramHeight = heightWithoutButton / [self.params count];
CGFloat originY = 0;
for (MLOTestingTileParameter * param in self.params) {
[param setParamFrame:CGRectMake(0,
originY,
width,
paramHeight)];
originY+=paramHeight;
}
self.renderButton.frame = CGRectMake(0,
originY,
width,
RENDER_BUTTON_HEIGHT);
}
-(void)addToMainViewController{
-(void)addToSuperview{
NSLog(@"%@ addToSuperview",self);
[self.tester.view addSubview:self.view];
for (MLOTestingTileParameter * param in self.params) {
[param addToSuperview];
}
[self.view addSubview:self.renderButton];
}
-(void)renderTile{
NSLog(@"%@ renderTile",self);
for (MLOTestingTileParameter * param in self.params) {
[param extract];
}
[self.tester.renderer render];
}
@end
......@@ -10,5 +10,5 @@
#import "MLOTestingTileSubviewControllerProtocol.h"
@interface MLOTestingTileRendererViewController : MLOViewController<MLOTestingTileSubviewControllerProtocol>
-(void)render;
@end
......@@ -8,9 +8,12 @@
#import "MLOTestingTileRendererViewController.h"
#import "MLOAppRoleTileTester.h"
#import "MLOTestingTile.h"
@interface MLOTestingTileRendererViewController ()
@property MLOAppRoleTileTester * tester;
@property UIScrollView * scrollView;
@property MLOTestingTile * tile;
@end
@implementation MLOTestingTileRendererViewController
......@@ -19,14 +22,34 @@
self = [self init];
if(self){
self.tester = tester;
[self initScrollView];
}
NSLog(@"%@ initWithTester",self);
return self;
}
-(void)initScrollView{
self.scrollView = [UIScrollView new];
self.view = self.scrollView;
}
-(void)resize{
NSLog(@"%@ resize",self);
[self.tile resize];
}
-(void)addToMainViewController{
-(NSString *)description{
return @"MLOAppRoleTileTester";
}
-(void)addToSuperview{
NSLog(@"%@ addToSuperview",self);
[self.tester.view addSubview:self.view];
}
-(void)render{
[self.tile removeFromSuperview];
self.tile = [[MLOTestingTile alloc] initWithTester:self.tester];
[self.scrollView addSubview:self.tile];
self.scrollView.contentSize = self.tile.frame.size;
}
@end
......@@ -11,6 +11,6 @@
@class MLOAppRoleTileTester;
@protocol MLOTestingTileSubviewControllerProtocol <NSObject>
-(id)initWithTester:(MLOAppRoleTileTester *)tester;
-(void)addToMainViewController;
-(void)addToSuperview;
-(void)resize;
@end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment