下面的代码演示了创建一个小图标从时间的左侧移动到时间右侧的简单效果,关于自定义状态栏可以参考。

CGRect frame = {{0,0},{320,20}};
UIWindow *wd = [[UIWindow alloc] initWithFrame:frame];
[wd setBackgroundColor:[UIColor clearColor]];
[wd setWindowLevel:UIWindowLevelStatusBar];
frame = CGRectMake(100,0,30,20);
UIImageView *imgv = [[UIImageView alloc] initWithFrame:frame];
[imgv setContentMode:UIViewContentModeCenter];
[imgv setImage:[UIImage imageNamed:@"0103.png"]];
[wd addSubview:imgv];
[wd makeKeyAndVisible];

[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:2];
frame.origin.x += 150;
[imgv setFrame:frame];
[UIView commitAnimations];
[imgv release];


 

相关文章:

  • 2021-12-19
  • 2022-12-23
  • 2022-12-23
  • 2022-02-01
  • 2022-02-07
  • 2021-11-25
  • 2022-12-23
  • 2021-08-30
猜你喜欢
  • 2022-01-30
  • 2021-09-14
  • 2022-12-23
  • 2021-12-18
  • 2022-12-23
  • 2021-12-18
  • 2021-12-04
相关资源
相似解决方案