I still can't get this to work after looking at those examples. I want to be able to send x and y points to my UIView subclass called "View" which will update the screen and display the pixel. Then I want to send more points and continually update to display all the points.
This is my current code:
//View_Controller.h
#import <UIKit/UIKit.h>
@class View;
@interface Mandelbrot_SetViewController : UIViewController {
View *otherView;
}
@property(nonatomic, retain)View *otherView;
@end
//View_Controller.m
#import "Mandelbrot_SetViewController.h"
#import "ComplexNumber.h"
#import "View.h"
@implementation Mandelbrot_SetViewController
@synthesize otherView;
@class View;
...
...
- (void)viewDidLoad {
[otherView setXY:100 andY:100];
[super viewDidLoad];
}
...
@end
//View.h
#import <UIKit/UIKit.h>
@interface View : UIView {
}
- (void)setXY:(double)ax andY:(double)ay;
@end
//View.m
#import "View.h"
@implementation View
- (id)initWithFrame:(CGRect)frame {
if ((self = [super initWithFrame:frame])) {
// Initialization code
}
return self;
}
- (void)setX:(double)ax andY:(double)ay{
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetRGBFillColor(context, 0.0, 0.0, 0.0, 1.0); // black colour
CGContextFillRect(context, CGRectMake(ax, ay, 1.0, 1.0)); // draw pixel
[self setNeedsDisplay];
}
/*
- (void)drawRect:(CGRect)rect;
{
}
*/
- (void)dealloc {
[super dealloc];
}
@end
The screen will not show the pixels. Any help is greatly appreciated :)