美文网首页
UILabel90度翻转

UILabel90度翻转

作者: frola_ | 来源:发表于2017-10-12 11:26 被阅读0次

    需要在fixedview上添加两个Label,文字相同只有方向不同

    directionPromptLabel1竖直方向
    directionPromptLabel2横屏方向

    将定义好的directionPromptLabel1赋值给temp然后再做修改
    解决方法:将directionPromptLabel1 90度反转之后再定位
    
    //底层view
    UIView *fixedview = [[UIView alloc]initWithFrame:CGRectMake(0, 0, SCREENWIDTHTT, SCREENHEIGHT - 80-22)];
    UILabel directionPromptLabel1 = [[UILabel alloc]initWithFrame:CGRectMake(0,SCREENHEIGHTTT -124, SCREENWIDTH, 20)];
        directionPromptLabel1.text = NSLocalizedString(@"添加无发票明细 >", nil);
        directionPromptLabel1.textAlignment = NSTextAlignmentCenter;
    
        directionPromptLabel2 = [[UILabel alloc]initWithFrame:CGRectMake(0,SCREENHEIGHTTT -124, SCREENWIDTH, 20)];
        directionPromptLabel2.text = NSLocalizedString(@"添加无发票明细 >", nil);
        directionPromptLabel2.textAlignment = NSTextAlignmentCenter;
        directionPromptLabel2.transform = CGAffineTransformMakeRotation(M_PI/2);
        directionPromptLabel2.leftL = 30;
        directionPromptLabel2.numberOfLines = 0;
        directionPromptLabel2.centerY = fixedview.centerY;
        
        directionPromptLabel2.textColor = [UIColor whiteColor];
        directionPromptLabel1.textColor = [UIColor whiteColor];
        [fixedview addSubview:directionPromptLabel1];
        [fixedview addSubview:directionPromptLabel2];
    

    相关文章

      网友评论

          本文标题:UILabel90度翻转

          本文链接:https://www.haomeiwen.com/subject/xnpnyxtx.html