弹出框自定义

 viewPop = [[UIView alloc]initWithFrame:CGRectMake(0, 0, KSCreenWidth-60, 240)];

    viewPop.backgroundColor = [UIColor whiteColor];

    viewPop.center = player.view.center;

    [player.view addSubview:viewPop];

    

    UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(20, 40, viewPop.frame.size.width-40, 30)];

    label.text = @"学习目标";

    label.font = [UIFont systemFontOfSize:22];

    label.textAlignment = NSTextAlignmentCenter;

    [viewPop addSubview:label];

    

    UILabel *labelLine = [[UILabel alloc]initWithFrame:CGRectMake(20, 40+35, viewPop.width-40, 1)];

    labelLine.backgroundColor = [UIColor blackColor];

    [viewPop addSubview:labelLine];

    

    UIButton *removBtn = [UIButton buttonWithType:UIButtonTypeSystem];

    removBtn.frame = CGRectMake(viewPop.frame.size.width-45, 10, 35, 35);

    [removBtn setBackgroundImage:[UIImage imageNamed:@"icon_goodsdetail_cancel"] forState:UIControlStateNormal];

    [viewPop addSubview:removBtn];

//    removBtn.layer.cornerRadius = 17.5;

    [removBtn addTarget:self action:@selector(removeButton) forControlEvents:UIControlEventTouchUpInside];

    

    NSArray *arr = @[@"1.播放本地或网络视频.",@"2.自定义视频播放器尺寸,视频分辨率与播放页面尺寸不匹配,小于播放页面尺寸,会默认用黑色填充,保持宽高比.",@"3.暂停时弹出视图."];

    

    int textLabelY = labelLine.bottom+10;

    for (int i=0; i<arr.count; i++) {

        

        UILabel *textLabel = [[UILabel alloc]initWithFrame:CGRectMake(20, textLabelY, viewPop.width-40, 30)];

        textLabel.text = arr[i];

        [viewPop addSubview:textLabel];

        

        textLabel.numberOfLines = 0;

        [textLabel sizeToFit];

        

        textLabelY = textLabelY +textLabel.height+7;

    }

    

    

 

posted @ 2017-03-27 11:11  樊特西style  阅读(121)  评论(0)    收藏  举报