浮动按键
分类:计算机编程

图片 1Untitled.gif

UITouch *touch = [touches anyObject]; CGPoint currentPosition = [touch locationInView:self]; //偏移量 float offsetX = currentPosition.x - beginpoint.x; float offsetY = currentPosition.y - beginpoint.y; //移动后的中心坐标 CGPoint point =CGPointMake(self.center.x   offsetX, self.center.y   offsetY); //最大centX CGFloat maxCenterX =main_width-self.frame.size.width*0.5 40; //最小centX CGFloat minCenterX =self.frame.size.width*0.5; CGFloat miniCenterY =self.frame.size.height*0.5 60; CGFloat maxCenterY =main_height-self.frame.size.height*0.5-40; if( point.x>=minCenterX && point.x <=maxCenterX && point.y>= miniCenterY && point.y<= maxCenterY){ self.center = point; }

本文由pc28.am发布于计算机编程,转载请注明出处:浮动按键

上一篇:iOS玩转地图,基于百度地图SDK记录运动轨迹 下一篇:没有了
猜你喜欢
热门排行
精彩图文