1 つのアプリを iOS 6 から iOS 7 に更新しています。しかし、クラスの種類に関する問題が発生しています。iOS 6 ではクラス名のカスタム ボタンを表示していますが、iOS 7 では _UITextContainerView を表示します。
for (UIView *subView in textViewButton.subviews)
{
NSLog(@"yourObject is a: %@", [subView class]);
@autoreleasepool
{
if([subView isKindOfClass:[CustomButton class]])
{
CustomButton *button = (CustomButton*)subView;
button.backgroundColor = [UIColor redColor];
[button setType:kButtonTypeQuestion];
button.titleLabel.font = kFontForContentPhone;
if (button.tag == 62254 || button.tag == 62263)
{
CGRect tempFrame = button.frame;
tempFrame.origin.x = button.frame.origin.x - 3.0f;
button.frame = tempFrame;
}
if (self.soundFile != nil)
{
CGRect tempFrame = button.frame;
tempFrame.size.width = button.frame.size.width + 28.0f;
button.frame = tempFrame;
[button setContentEdgeInsets:UIEdgeInsetsMake(5.0f, 30.0f, 5.0f, 10.0f)];
}
}
}
}
アップデート
pragma mark - テキスト段落 iPhone
self.questionScrollView = [[CustomScrollView alloc] initWithFrame:CGRectMake(0, currentYPosition, self.frame.size.width, self.frame.size.height - currentYPosition - 60.0f)];
self.questionScrollView.showsVerticalScrollIndicator = NO;
self.questionsContainer = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.questionScrollView.frame.size.width, self.questionScrollView.frame.size.height)];
currentYPosition = 0;
for (Question *question in self.questions)
{
@autoreleasepool
{
self.ttmItem = [[TapToMoveItem alloc] initWithFrame:CGRectMake(0, currentYPosition, self.frame.size.width, self.frame.size.height)];
self.ttmItem.ttmDelegate = self;
self.ttmItem.variant = self.exercise.variant;
ttmItem.x_Position = question.x_position;
ttmItem.y_Position = question.y_position;
if ([question.sound_file length] > 0 || question.sound_file != nil)
self.ttmItem.hasAudio = YES;
else
self.ttmItem.hasAudio = NO;
if ([kPrefixImage isEqualToString:@"preint_"] && ([self.exercise.exercise_id integerValue] == 54 || [self.exercise.exercise_id integerValue] == 91)) {
ttmItem.soundFile = self.exercise.header_title;
}
self.ttmItem.prefix = question.prefix;
self.ttmItem.text = question.text;
self.ttmItem.longestPrefix = longestPrefix;
self.ttmItem.longestAnswer = longestAnswer;
self.ttmItem.buttonWidth = sizeForButton.width;
//get and set answers
ttmItem.answers = [self.answers objectForKey:question.question_id];
[self.ttmItem createForPhone];
[self.questionsContainer addSubview:self.ttmItem];
currentYPosition += ttmItem.frame.size.height + SPACE_BET_VIEWS;
// itemHeight = ttmItem.frame.size.height; //hack
// itemWidth = ttmItem.frame.size.width;
ttmCount++;
if ([ttmItem.arrayOfTextViewButtons count] > 0) {
[dictionaryOfItemButtons setObject:ttmItem.arrayOfTextViewButtons forKey:question.question_id];
}
}
}
self.questionsContainer.frame = CGRectMake(questionsContainer.frame.origin.x, questionsContainer.frame.origin.y, questionsContainer.frame.size.width, currentYPosition );
[self.questionScrollView setContentSize:self.questionsContainer.frame.size];
[self.questionScrollView addSubview:self.questionsContainer];
[self addSubview:self.questionScrollView];
[self setScrollEnabled:NO];
}
オブジェクトのクラス名が異なる理由がわかりません。さらに、Googleでこれに関する問題は見つかりませんでした。誰かがこれについて考えているなら、私を助けてください。
前もって感謝します。