I replaced Juce Viewport with native iOS UIScrollView
Here is gist of my Viewport. You can modify ListBox or TableListBox to use this Viewport and it will work great on iOS.
ios_viewport.cpp
/*
This file is part of the JUCE library - "Jules’ Utility Class Extensions"
Copyright 2004-11 by Raw Material Software Ltd.
JUCE can be redistributed and/or modified under the terms of the GNU General
Public License (Version 2), as published by the Free Software Foundation.
A copy of the license is included in the JUCE distribution, or can be found
online at www.gnu.org/licenses.
JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
This file has been truncated. show original
ios_viewport.h
#include <JuceHeader.h>
//==============================================================================
/*
A Viewport is used to contain a larger child component, and allows the child
to be automatically scrolled around.
To use a Viewport, just create one and set the component that goes inside it
using the setViewedComponent() method. When the child component changes size,
This file has been truncated. show original
ios_viewport.mm
#include "ios_viewport.h"
#if __OBJC__ && JUCE_IOS
#include <UIKit/UIKit.h>
@interface JuceUIScrollView : UIScrollView<UIScrollViewDelegate>
{
@private
Viewport* owner;
This file has been truncated. show original
Most important part is in ios_viewport.mm.
Once added to project make sure to specify that ios_viewport.mm is Objective-C++ in Xcode and you added flag “-fno-objc-arc” to compiler schema.
3 Likes