重绘机制 导致绘制的控件重叠

来源:互联网 发布:MAC maven安装配置 编辑:程序博客网 时间:2024/05/18 09:15

1.- (void)setNeedsDisplayInRect:(CGRect)invalidRect 

2.dispatch_semaphore_t


dispatch_queue_t queue = dispatch_get_global_queue(00);

    dispatch_semaphore_t semaphore = dispatch_semaphore_create(1);

    NSMutableArray *array = [NSMutableArrayarray];

    for (int index = 0; index < 100000; index++) {

        dispatch_async(queue, ^(){

            dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER);//

            NSLog(@"addd :%d", index);

            [array addObject:[NSNumber numberWithInt:index]];

            dispatch_semaphore_signal(semaphore);

        });

    }


0 0
原创粉丝点击