范文无忧网计划总结报告汇报

ios uiview的小标怎么写

02月23日 编辑 fanwen51.com

[怎么申请退款啊ios的]ios申请退款可在iTunes软件里面查询记录订单编号、提交退款申请。 1、电脑打开iTunes软件,打开“Apple – 技术支持 – Express Lane”页面。在列表中依次选择“iTunes” ->...+阅读

方法/步骤MJViewController.h#importinterface MJViewController : UIViewControllerproperty (weak, nonatoic) IBOutlet UIButton *btn;// 行走- (IBAction)run:(id)sender;// 缩放- (IBAction)scale:(id)sender;// 旋转- (IBAction)rotate:(id)sender;endMJViewController.m#import "MJViewController.h"#define kDelta 50//const int delta = 50;interface MJViewController ()endimplementation MJViewController#pragma mark 控制按钮走动(上下左右)- (IBAction)run:(id)sender { // 0.动画(头部-开始动画) [UIView beginAnimations:nil context:nil]; // 设置动画的执行时间 [UIView setAnimationDuration:1.0]; // 1.先取出frame CGRect tempFrame = _btn.frame; // 2.取出按钮的tag标记 int tag = [sender tag]; // CGFloat delta = 100; switch (tag) { case 1: // 上 tempFrame.origin.y -= kDelta; break; case 2: // 右 tempFrame.origin.x += kDelta; break; case 3: // 下 tempFrame.origin.y += kDelta; break; case 4: // 左 tempFrame.origin.x -= kDelta; break; default: break; } // 3.重新赋值按钮的frame _btn.frame = tempFrame; // 4.动画(尾部-提交动画-执行动画) [UIView commitAnimations];}#pragma mark 放大\缩小- (IBAction)scale:(id)sender { // 0.动画(头部-开始动画) [UIView beginAnimations:nil context:nil]; // 设置动画的执行时间 [UIView setAnimationDuration:1.0]; // 1.计算缩放比例 CGFloat scale = [sender tag] == 20 ? 1.2 : 0.8; // 2.修改按钮形变属性 _btn.transform = CGAffineTransformScale(_btn.transform, scale, scale); // 4.动画(尾部-提交动画-执行动画) [UIView commitAnimations];}#pragma mark 左旋转\右旋转- (IBAction)rotate:(id)sender {// _angle -= M_PI_4; // 0.动画(头部-开始动画) [UIView beginAnimations:nil context:nil]; // 设置动画的执行时间 [UIView setAnimationDuration:1.0]; // 弧度 3.14 - π // 角度 180 // 向左旋转45°// _btn.transform = CGAffineTransformMakeRotation(- M_PI_4);// _btn.transform = CGAffineTransformRotate(_btn.transform, M_PI_4 * (10 == tag?-1:1)); int tag = [sender tag]; if (10 == tag) { // 左 _btn.transform = CGAffineTransformRotate(_btn.transform, M_PI_4 * -1); } else { // 右 _btn.transform = CGAffineTransformRotate(_btn.transform, M_PI_4 * 1); } // 4.动画(尾部-提交动画-执行动画) [UIView commitAnimations];}end

推荐阅读
图文推荐
栏目列表