模态视图中添加代码的具体方法

来源:互联网 发布:js canvas 动画库 编辑:程序博客网 时间:2024/06/04 00:18
-(void)redifineView:(UIView *)changeView{
    if (changeView !=nil) {
        
        for(UIView *view in [changeView subviews])
        {
            [view removeFromSuperview];
        }
        UILabel *myLabel=[[UILabel alloc]initWithFrame:CGRectMake(0, 0, CGRectGetWidth(changeView.bounds),30)];
        myLabel.text=@"Hello Label";
        myLabel.backgroundColor=[UIColor redColor];
        [self.popupView addSubview:myLabel];
        
        UIButton *button=[[UIButton alloc]initWithFrame:CGRectMake(0, 30, CGRectGetWidth(changeView.bounds),20)];
        button.titleLabel.text=@"Button";
        button.backgroundColor=[UIColor blueColor];
        [self.popupView addSubview:button];
        

    }
}
0 0
原创粉丝点击