iOS 笔试题目

作者: littleGG 发布时间: 2019-08-08 浏览: 1729 次 编辑

1、下面的代码有什么问题

BOOL (^finishedBlock)(BOOL finished) = ^(BOOL finished){
    self.view.frame = CGRectZero;
    self.view.alpha = 0;
};
self.finishedBlock = finishedBlock;



2、Person *per = [[Person alloc] init];

self.personA = per;

self.personB = [per copy];

per 的retianCount是(   )

  


3、@property (atomic, copy)NSMutableArray *array;对array的insert和remove操作会发生什么?操作是否线程安全?



4、

现有 A、B、C 三个View,他们之间的关系:A 是最底层的View, B 是中间的,C 是最上层的,B 是 A 的subview,C 是 A 的subview,如果一个点击事件在 C 的范围内发生,设 C 的 userInterActionEnable = NO;那么接下来该由谁来响应此事件?



5、根据代码画图

- (void)drawRect:(CGRect)rect {
    CGRect inFrame = CGRectMake(0, 0, 100, 100);
    CGContextRef ctx = UIGraphicsGetCurrentContext();
    CGContextSetLineWidth(ctx, 1);
    CGContextSetStrokeColorWithColor(ctx, [[UIColor blackColor] CGColor]);
    CGContextAddEllipseInRect(ctx, inFrame);
    CGContextMoveToPoint(ctx, CGRectGetMidX(inFrame), CGRectGetMinY(inFrame));
    CGContextAddLineToPoint(ctx, CGRectGetMinX(inFrame), CGRectGetMidY(inFrame));
    CGContextAddLineToPoint(ctx, CGRectGetMaxX(inFrame), CGRectGetMidY(inFrame));
    CGContextAddLineToPoint(ctx, CGRectGetMidX(inFrame), CGRectGetMinY(inFrame));
    CGContextStrokePath(ctx);
    
}

答案很容易找到,这里就不多做解释了。

标签: