This was niggling at me so gave it a go and yes, it is definitely possible, a little convoluted but this process could probably be simplified using a static helper method.
Simply create a UIScrollView in your xib file and an accompanying property in your view controller class's header. Make sure you synthesize the property in your implementation and attach it from your 'File's Owner' in Interface Builder to your UIScrollView.
Now you have to do a bit of Juce trickery to add your component to a UIView first. Create one with the size you want your content to be. Then add your component to the UIView you have just created, make it visible and set its bounds to that of the UIView. Then you need to update the UIScrollView's contentSize property with your UIView's bounds. Finally you need to add your UIView to to your UIScrollView.
The code might help make sense of that:
- Code: Select all
@interface MainViewController : UIViewController
{
TextButton textButton;
}
@property (nonatomic, retain) IBOutlet UIScrollView* scrollView;
@end
and in the implementation file:
- Code: Select all
@implementation MainViewController
@synthesize scrollView;
- (void)viewDidLoad
{
[super viewDidLoad];
UIView* contentUIView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, // x,y offset
scrollView.bounds.size.width * 2, // content width
scrollView.bounds.size.height * 2)]; // content height
textButton.addToDesktop (0, (void*) contentUIView);
textButton.setVisible (true);
textButton.setBounds(contentUIView.bounds.origin.x, contentUIView.bounds.origin.y,
contentUIView.bounds.size.width, contentUIView.bounds.size.height);
scrollView.contentSize = contentUIViewForScrollToHold.bounds.size;
[scrollView addSubview:contentUIView];
[contentUIView release];
}
@end
I'm not sure how this would react if you changed the scroll view's size or the internal UIView's size, you would probably have to update the component's size as well. The other problem is that any transparency in Juce components seems to just be black, I haven't really looked into this yet.
If you make any improvements to this let us know because mixing iOS and Juce is something I'm sure a lot of people want to do.