Reputation: 21
I'm trying to draw a graph in a UIView with
-(void)drawRect:(CGRect)rect
{
[super drawRect:rect];
CGContextMoveToPoint(context, 0f, 0f);
CGContextAddLineToPoint(context, Value1, 0);
CGContextStrokePath(context);
}
If I define Value1 Inside my UIView.m it works but: Value1 should be transferred from another ViewController, where i type the Value into a Textfield.
How do I transfer Value 1 into my UIView?
(I could transfer the Value to another ViewController, but in the ViewController my drawRect method doesn't work)
Upvotes: 2
Views: 69
Reputation: 24195
YourViewClass.h
{
@public
CGFloat Value1;
}
ViewController
myView->Value1 = someValue;
[myView setNeedsDisplay];
Upvotes: 1