UILabel90度翻转

2017-10-12  本文已影响0人  frola_

需要在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];
上一篇下一篇

猜你喜欢

热点阅读