I have subclassed QCPlugInViewController to handle the IBAction I
called amendStrings that adds, removes in increments in response to
NSStepper and when the textfield is manually edited.
The subclass of QCPlugInViewController looks like this:
@interface UITestPlugInViewController : QCPlugInViewController
{
int currentStringCount;
int previousStringCount;
int diff;
BOOL raisedFlag;
BOOL loweredFlag;
BOOL firstCall;
}
- (IBAction) amendStrings:(id)sender;
@end
I am wondering: do I need to subclass QCPlugInViewController at all?
Should the ivars (the ints) be dynamic properties of qcplugin? and
are therefore 'serialised' when the patch is copied?
You should not have to create an QCPluginViewController subclass. You
also don't really need to store all the view controllers in an array
unless you really need them. And you probably won't. Just take the NIB
file provided by the Xcode template (assuming you started your patch
using the right Xcode template) and hook up all the bindings just the
way you did. Then, implement a custom -setNoOfStrings: method which
saves the new count into the ivar and then calls the following method
(I didn't write that one myself, it probably comes from the docs...):
- (void) setArgumentCount:(NSUInteger)newCount {
NSUInteger i, currentCount = self.argumentCount;
/* Update argument input ports */
if(newCount > currentCount) {
for(i = currentCount; i < newCount; ++i)
[self addInputPortWithType:QCPortTypeString
forKey:[NSString
stringWithFormat:@"argument_%i", i]
withAttributes:[NSDictionary dictionaryWithObject:[NSString
stringWithFormat:@"Argument #%i", i + 1]
forKey:QCPortAttributeNameKey]];
}
else if(newCount < currentCount) {
for(i = newCount; i < currentCount; ++i)
[self removeInputPortForKey:[NSString stringWithFormat:@"argument_
%i", i]];
}
/* Save new argument count */
argumentCount = newCount;
}
This should get you going. Please forgive me if this isn't everything
you need to get going, I didn't read all your code just now : )
Marco
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/archive%40mail-archive.com
This email sent to [EMAIL PROTECTED]