iOS学习

  三天前结束了OC的考核,今天要开始学习iOS课程的UI了. 昨天大概翻了翻买的iOS相关的书,照着书上的步骤敲了敲, 刚开始的概念还是很形象的,比如说拖页与分页就像是用镜头来取景一样,自动内存管理(ARC)减轻了程序员的内存管理方面的工作量,但必要时还是要使用手动内存管理(MRC),就像循环强引用(易造成内存泄露)就不能使用ARC解决,需要手动将其中一个设置成弱指针. 界面绘图代码也比较精简,例如下面程序循环画圆:

- (void)drawRect:(CGRect)rect

{

    CGRect bouns=self.bounds;

    UIBezierPath *path=[[UIBezierPath alloc] init];

    float maxRadius=hypotf(bouns.size.width, bouns.size.height);

    for(float currentRadius=maxRadius;currentRadius>0;currentRadius-=20)

    {

        [path moveToPoint:CGPointMake(_centerPoint.x+currentRadius, _centerPoint.y)];

        [path addArcWithCenter:_centerPoint radius:currentRadius startAngle:0.0 endAngle:PI*2.0 clockwise:YES];

    }

    path.lineWidth=10;

    [self.circleColor setStroke];

    [path stroke];

}

http://www.cnblogs.com/PaulpauL/ 版权声明:本文为博主原创文章,未经博主允许不得转载。
原文地址:https://www.cnblogs.com/PaulpauL/p/4753757.html