The Omni Group
These forums are now read-only. Please visit our new forums to participate in discussion. A new account will be required to post in the new forums. For more info on the switch, see this post. Thank you!

Go Back   The Omni Group Forums > Developer > Omni Frameworks
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Mending the ScalingScrollView example... Thread Tools Search this Thread Display Modes
Hi all -

The ScalingScrollView example in OmniUI has been broken for a little while. No sure when it started, but our benefactors here have enough on their hands so we should all understand. Here are some steps to get it back into shape.

Tim and co. feel free to edit/correct if things can be done better or don't make sense, but it gets it back into shape for me.

Attention: I assume a good knowledge of Xcode and don't go into all the gory details. Not for total noobs. Sorry...

1 - Open the ScalingScrollView project file and add the FixStringFile project in Tools.
2 - Xcode will ask you if you want to make this a workspace. Say Yeah! and save it in the workspace directory along with TextEditor.
3 - Add the OmniUnzip project to your frameworks, target dependencies and Link binaries (under Build Phases). NOTE: the order in Target Dependencies is important: place it above FileStore.
4 - Edit your scheme to add FixStringsFile and make sure parallel builds and stuff are turned off!
5 - Add the ImageIO Framework to your Link Binary With Libraries section in Build Phases
6 - Try a build. It should succeed but the run will crash trying to resolve some methods in the Main App Controllers. See, this AppDelegate doesn't subclass the SingleDocumentAppController, nuff said...
7 - Not to worry we have a workaround. Subclass OUIScalingScrollView and add two new files. I call them simply ScrollView.h and ScrollView.m. We will replace the scroll view class in the xib with these (see below)
8 - open your ScalingScrollViewController.xib and change the class of the scroll view to "ScrollView". Make sure to connect all the parts (especially the scaling view ivar/property)
9 - Build (successfully) again and run...
10- play with the Big Red Square again...

Hope this helps.

Regards, Patrice

---- ScrollView.h ------------------
@class ScalingView;

@interface ScrollView : OUIScalingScrollView
    ScalingView *_scalingView;

@property(retain,nonatomic) IBOutlet ScalingView *scalingView;

---- ScrollView.m ------------------

#import "ScrollView.h"
#import "ScalingView.h"


@implementation ScrollView

@synthesize scalingView = _scalingView;

- (void)dealloc;
    [_scalingView release];
    [super dealloc];

- (CGFloat)fullScreenScaleForCanvasSize:(CGSize)canvasSize;
    // App doesn't inherit from OUISingleDocumentAppController ...
#if 0
    UIViewController *mainViewController = [[OUIAppController controller] topViewController];
    OBASSERT([mainViewController isKindOfClass:[OUIMainViewController class]]);
    UIView *backgroundView = [(OUIMainViewController *)mainViewController view];
    OBASSERT([backgroundView isKindOfClass:[OUIMainViewControllerBackgroundView class]]);
    CGRect scrollBounds = [(OUIMainViewControllerBackgroundView *)backgroundView contentViewFullScreenBounds];    
    CGRect scrollBounds = self.bounds;    
    CGFloat fitXScale = CGRectGetWidth(scrollBounds) / canvasSize.width;
    CGFloat fitYScale = CGRectGetHeight(scrollBounds) / canvasSize.height;
    CGFloat fullScreenScale = MIN(fitXScale, fitYScale); // the maximum size that won't make us scrollable.
    return fullScreenScale;

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

All times are GMT -8. The time now is 01:15 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2020, vBulletin Solutions, Inc.