一个很不错的类库LFMediaEditing
里面对应的添加文本的功能是基于view层,这个在主工程允许横竖屏时很好用,但是当前项目主工程不支持横竖屏,单独这个添加文本框时有横竖问题,所以使用了控制器进行起界面,记录一下view起界面的代码,如下:
备注:通过[[UIDevice currentDevice] 横屏
//- (void)showTextBarController:(LFText *)text {
// self.currentEditingButton.selected = NO;
//
// __weak typeof(self)weakSelf = self;
//// LFTextBar *textBar = [[LFTextBar alloc] initWithFrame:self.frame
//// layout:^(LFTextBar *textBar) {
//// __strong typeof(self)strongSelf = weakSelf;
//// textBar.oKButtonTitleColorNormal = UIColor.whiteColor;
//// textBar.cancelButtonTitleColorNormal = UIColor.whiteColor;
//// textBar.oKButtonTitle = @"保存";
//// textBar.cancelButtonTitle = @"取消";
//// textBar.customTopbarHeight = 64;
//// textBar.naviHeight = 64;
//// textBar.showText.textColor = strongSelf.drawView.selfPainColor;
////
//// }];
// [self addSubview:textBar];
//
// if ([self.orientation isEqualToString:@"landscape_left"]) {
// [textBar mas_remakeConstraints:^(MASConstraintMaker *make) {
// make.center.mas_equalTo(0);
// make.width.mas_equalTo(SCREEN_HEIGHT);
// make.height.mas_equalTo(SCREEN_WIDTH);
// }];
// [[UIDevice currentDevice] setValue:[NSNumber numberWithInteger:UIDeviceOrientationLandscapeLeft] forKey:@"orientation"];
//
// textBar.transform = CGAffineTransformMakeRotation(90 * M_PI/180.0);
// textBar.currentOrientation = JZYCurrentOrientation_left;
// }else if ([self.orientation isEqualToString:@"landscape_right"]) {
// [textBar mas_remakeConstraints:^(MASConstraintMaker *make) {
// make.center.mas_equalTo(0);
// make.width.mas_equalTo(SCREEN_HEIGHT);
// make.height.mas_equalTo(SCREEN_WIDTH);
// }];
//
// [[UIDevice currentDevice] setValue:[NSNumber numberWithInteger:UIDeviceOrientationLandscapeRight] forKey:@"orientation"];
//
// textBar.transform = CGAffineTransformMakeRotation(-90 * M_PI/180.0);
// textBar.currentOrientation = JZYCurrentOrientation_right;
// }
//
//
// textBar.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
// text.textColor = UIColor.whiteColor;
// textBar.showText = text;
// textBar.delegate = self;
// [textBar becomeFirstResponder];
//
//}
网友评论