setNeedsDisplay为什么没有用?(按需结贴 肯定有分)

#import 
#import 
#define PI 3.14159265358979323846
@implementation GameView

int msa=100,msb=100, mea=200,meb=200;
//初始化两个圆的中心点
- (IBAction)next:(id)sender {
    int msa = 200;
    int msb = 200;
    int mea = 100;
    int meb = 100;
 [_gameview setNeedsDisplay];
 }
//想做的事情,点击按钮后改变两个圆的坐标,并重新加载DrawRect

-(void) drawRect:(CGRect)rect
{   
    [Drawing drawStartpoint:msa :msb];
    [Drawing drawEndpoint:mea :meb];
 }
//下面是画两个圆的类和方法
#import "Drawing.h"
+(void) drawStartpoint:(int)a :(int)b
{
    
    CGContextRef context = UIGraphicsGetCurrentContext();
    
    CGContextSetRGBFillColor(context, 1, 0, 0, 1);
    
    CGContextAddArc(context, a, b, 20, 0, 2*PI, 0); //添加一个圆
    
    CGContextDrawPath(context, kCGPathFill);//绘制填充}
}
+(void) drawEndpoint:(int)a :(int)b
{
    
    CGContextRef context = UIGraphicsGetCurrentContext();
    
    CGContextSetRGBFillColor(context, 0, 1, 0, 1);
    
    CGContextAddArc(context, a, b, 20, 0, 2*PI, 0); //添加一个圆
    
    CGContextDrawPath(context, kCGPathFill);//绘制填充}
}

为什么点击按钮后没有反应?

你可能感兴趣的:(setNeedsDisplay为什么没有用?(按需结贴 肯定有分))