当前位置: 编程技术>移动开发
本页文章导读:
▪UIView 卡通 transform CGAffineTransformIdentity UIView 动画 transform CGAffineTransformIdentity;
#import "ViewController.h"
@implementation ViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:.........
▪ 点击父控件,子控件发作被点击的效果 点击父控件,子控件产生被点击的效果
如果设置此属性,将直接从父容器中获取绘图状态(光标,按下等)。 注意仅仅是获取绘图状态,而没有获取事件,也就是你点一下LinearLayout时Button.........
▪ 取得当前正在显示的activity的类名 获得当前正在显示的activity的类名
......
[1]UIView 卡通 transform CGAffineTransformIdentity
来源: 互联网 发布时间: 2014-02-18
UIView 动画 transform CGAffineTransformIdentity;
#import "ViewController.h" @implementation ViewController - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { // Custom initialization } return self; } - (void)viewDidLoad { [super viewDidLoad]; iv = [[UIImageView alloc] initWithFrame:CGRectMake(100, 100, 100, 30)]; iv.image = [UIImage imageNamed:@"2"]; [self.view addSubview:iv]; [iv release]; [UIView animateWithDuration:1.0f animations:^(void){ iv.alpha = 0.0f; iv.transform = CGAffineTransformMakeTranslation(10.0f, 0.0f); }]; UIButton * btn = [UIButton buttonWithType:UIButtonTypeRoundedRect]; [btn setTitle:@"back" forState:UIControlStateNormal]; [btn addTarget:self action:@selector(btnPressed:) forControlEvents:UIControlEventTouchUpInside]; btn.frame = CGRectMake(200, 200, 50, 30); [self.view addSubview:btn]; UIButton * btn1 = [UIButton buttonWithType:UIButtonTypeRoundedRect]; [btn1 setTitle:@"disappear" forState:UIControlStateNormal]; [btn1 addTarget:self action:@selector(btn1Pressed:) forControlEvents:UIControlEventTouchUpInside]; btn1.frame = CGRectMake(250, 200, 50, 30); [self.view addSubview:btn1]; } -(void)btnPressed:(id)sender { [UIView animateWithDuration:1.0f animations:^(void){ iv.alpha = 1.0f; iv.transform = CGAffineTransformIdentity; }]; } -(void)btn1Pressed:(id)sender { [UIView animateWithDuration:1.0f animations:^(void){ iv.alpha = 0.0f; iv.transform = CGAffineTransformMakeTranslation(10.0f, 0.0f); }]; } @end CGAffineTransformIdentity属性能还原到 进行动画 之前的状态
[2] 点击父控件,子控件发作被点击的效果
来源: 互联网 发布时间: 2014-02-18
点击父控件,子控件产生被点击的效果
如果设置此属性,将直接从父容器中获取绘图状态(光标,按下等)。 注意仅仅是获取绘图状态,而没有获取事件,也就是你点一下LinearLayout时Button有被点击的效果(一定要用selector实现点击效果 ),但是不执行点击事件。
android:duplicateParentState="true"
[3] 取得当前正在显示的activity的类名
来源: 互联网 发布时间: 2014-02-18
获得当前正在显示的activity的类名
需要加一个权限:
<uses-permission android:name="android.permission.GET_TASKS"/>
ActivityManager manager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE); List<RunningTaskInfo> runningTasks = manager .getRunningTasks(1); RunningTaskInfo cinfo = runningTasks.get(0); ComponentName component = cinfo.topActivity; Log.e("current activity is ", component.getClassName());
最新技术文章: