iOS控件使用技巧1

iOS控件使用技巧1

  • UIScrollView移动到指定的位置
做了一个基于UIView + UIScrollView的曲线统计图,准备以此为基础,做一个通用的图标统计工具。 [lineScrollView scrollRectToVisible:CGRectMake(0, 200, 265, 200) animated:NO]
  • UITabBarItem字体大小的修改
[[UITabBarItem appearance] setTitleTextAttributes:@{UITextAttributeFont:[UIFont boldSystemFontOfSize:15]} forState:UIControlStateNormal];
  • UIView画曲线
  CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSetLineWidth(context, 1.0); CGContextSetRGBStrokeColor(context, 65/255.0, 132/255.0, 187/255.0, 1.0);
    CGPoint *points = (CGPoint *)malloc(sizeof(CGPoint) * self.pointsArr.count);
    for (int i = 0; i < self.pointsArr.count; i ++) {
        DPoint *dPoint = [self.pointsArr objectAtIndex:i];
        if (dPoint) {
            CGPoint pt;
            pt.x = dPoint.x;
            pt.y = dPoint.y;
            points[i] = pt;
        }
    }

    CGContextAddLines(context, points, self.pointsArr.count);
    CGContextDrawPath(context, kCGPathStroke);

    free(points);

  • iOS7 Navigation Bar默认字体和返回箭头的颜色修改 iOS7 Navigation Bar默认字体是蓝色的,如果我们要修改改其颜色,下面的代码可以self.navigationController.navigationBar.barTintColor = [UIColor blackColor]; self.navigationController.navigationBar.tintColor = [UIColor whiteColor]; [self.navigationController.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor whiteColor]}]; self.navigationController.navigationBar.translucent = NO;
 

你可能感兴趣的:(iOS控件使用技巧1)