标签:style blog http io color ar sp div on
背景图:
代码:
- (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. //红色的背景图 UIView *parentView=[[UIView alloc]initWithFrame:CGRectMake(50, 100, 200, 200)]; parentView.backgroundColor=[UIColor redColor]; [self.view addSubview:parentView]; [parentView setUserInteractionEnabled:YES]; //移动的手势 UIPanGestureRecognizer *panRcognize=[[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handlePan:)]; panRcognize.delegate=self; [panRcognize setEnabled:YES]; [panRcognize delaysTouchesEnded]; [panRcognize cancelsTouchesInView]; [parentView addGestureRecognizer:panRcognize]; } #pragma UIGestureRecognizer Handles - (void)handlePan:(UIPanGestureRecognizer *)recognizer { NSLog(@"--移动的手势-----"); }
标签:style blog http io color ar sp div on
原文地址:http://www.cnblogs.com/yang-guang-girl/p/4098994.html