ios开发教程中的一些小技巧

来源:互联网 发布:大数据 数据仓库 编辑:程序博客网 时间:2024/05/18 01:02
任何一项和技术沾边的事情,其实很多时候都是有一定的技巧的,大家在学习ios开发的时候其实也是一样的。只要是自己能够注意多看看和ios开发教程有关的小技巧,那么自己在学习ios开发教程以及掌握和ios开发教程有关的工作技能的时候就能够给自己提供很大的帮助。现在,我们就来看看关于ios开发教程的一些小技巧的代码。
1、捕获iphone通话事件:
CTCallCenter *center = [[CTCallCenter alloc] init];
center.callEventHandler = ^(CTCall *call)
{
NSLog(@"call:%@", call.callState);
}
2、iOS 4 引入了多任务支持,所以用户按下 “Home” 键以后程序可能并没有退出而是转入了后台运行。如果您想让应用直接退出,最简单的方法是:在 info-plist 里面找到 Application does not run in background 一项,勾选即可。
3、使UIimageView的图像旋转:
float rotateAngle = M_PI;
CGAffineTransform transform =CGAffineTransformMakeRotation(rotateAngle);
imageView.transform = transform;
4、设置旋转的原点:
#import <QuartzCore/QuartzCore.h>
UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed"bg.png"]];
imageView.layer.anchorPoint = CGPointMake(0.5, 1.0);
5、实现自定义的状态栏(遮盖状态栏):
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* img = [[UIImageView alloc] initWithFrame:frame];
[img setContentMode:UIViewContentModeCenter];
[img setImage:[UIImage imageNamed"00_0103.png"]];
[wd addSubview:img];
[wd makeKeyAndVisible];
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:2];
frame.origin.x += 150;
[img setFrame:frame];
[UIView commitAnimations];
     上述当中小编给大家总结的ios开发教程中的一些小技巧仅仅只是关于ios开发教程技巧的一部分,如果您还想要更为深入的了解以及学习关于ios开发教程中的一些小技巧,那么建议能够找时间在一些专业的大型ios开发网站上查看一些专业的ios开发教程知识信息,帮助自己提升在ios开发教程方面的知识技能。
0 0
原创粉丝点击