【发布时间】:2011-08-05 13:07:35
【问题描述】:
我有自定义视图图表和该视图 GraphViewController 的视图控制器。 我正在实现简单的图表。
这是 Chart.h 的代码
#进口 @interface 图表:UIView { BOOL 隐藏图表; } @property BOOL 隐藏图表; -(无效)drawAxesInContext:(CGContextRef)上下文; -(无效)drawUserChartinContext:(CGContextRef)上下文; @结尾图表.m
- (void)drawRect:(CGRect)rect { CGContextRef ctxt = UIGraphicsGetCurrentContext(); [self drawAxesInContext:ctxt]; [self drawUserChartinContext:ctxt]; } -(无效)drawAxesInContext:(CGContextRef)上下文{ CGContextTranslateCTM(context, nullX, nullY); CGContextScaleCTM(上下文, 1.0, -1.0); CGContextSetLineWidth(上下文, 3); CGContextBeginPath(上下文); 对于 (int i=0; 我正如您在屏幕截图中看到的那样,我有 uibutton“隐藏”。我想通过按此按钮隐藏图形(不是轴)。 在 viewController 我创建了 ibaction
- (IBAction) hideAndShow { self.chart.hideChart = YES; }在视图中你可以看到
如果(隐藏图表){ [[UIColor blackColor] setStroke]; [自我设置需求显示]; NSLog(@"隐藏"); }但它不起作用,你知道我该怎么做吗? http://dl.dropbox.com/u/866144/Voila_Capture7.png
【问题讨论】:
标签: ios uiview uiviewcontroller uibutton