阅读背景:

如何从另一个方法访问类实例

来源:互联网 

Here's my code:

这是我的代码:

#import "ViewController.h"

@implementation ViewController

- (void)viewDidLoad
{
  [super viewDidLoad];

  UIView *view1 = [[UIView alloc] initWithFrame:CGRectMake(50.0, 50.0, 0, 0)];
  [self.view addSubview:view1];
}


-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
    UITouch *touch = [[event allTouches] anyObject];
    if([touch.view isEqual:self]) {
        CGPoint point = [[touches anyObject] locationInView:self];
        NSLog(@"%@",NSStringFromCGPoint(point));
        self.view1.center = point;
     }
}
#import "ViewContro



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: