我在Class A
中的目标-C中有2个类:
我定义了:
@property (nonatomic, readwrite) BOOL fortextview;
并使用它:
if (![_support_long_messages boolValue]) {
[self showAlert];
_fortextview = false;
} else {
_fortextview = true ;
}
因此class B
取class A
的值并使用它:
@property (nonatomic, strong) MessagingKeyServerResponse *messaginKeyRespo;
MessagingKeyServerResponse是class A
。
在我的class B
我定义了if语句
- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text
{
NSUInteger newLength = [textView.text length] + [text length] - range.length;
if (_messaginKeyRespo.fortextview){
return (newLength > MESSAGE_MAX_LENGTH) ? NO : YES;
} else {
return (newLength > 160) ? NO : YES;
}
}
问题是价值没有通过,任何帮助升值 -
答案 0 :(得分:0)
创建全局变量然后它可以工作。
它解决了我的问题。 BOOL character_support;