я Носите несколько дней, пытаясь решить следующую проблему, но я ничего :(Layout сломана при viewDidDisappear
У меня есть ViewController с UIScrollView и некоторые подпанелей не получили, я добавляю некоторые из них по построению интерфейса и другим по коду.Когда я вызываю метод для push следующего viewController, текущий вид ломается и все еще сломан, когда я его всплываю.
Я попытался удалить настройку автозапуска с раскадровки, но все же
Я устанавливаю рамки представлений программно, и я перемещаю смещение содержимого scrollView для создания анимации.
Я звоню этот метод в viewWillAppear:
- (void)prepareQuestion
{
int nextYposition;
// Question
NSString *q = [self.theQuestion getQuestionTextForLanguage:lang];
NSString *badText = [self.theQuestion getInfTextForLanguage:lang];
NSString *goodText = [self.theQuestion getSupTextForLanguage:lang];
self.answer.questionID = self.theQuestion.questionID;
if (whiteStyle) {
question = [[NPSQuestionViewController alloc] initWithQuestion:q AndStyle:kNPSQuestionStyleWhite];
} else {
question = [[NPSQuestionViewController alloc] initWithQuestion:q AndStyle:kNPSQuestionStyleOther];
}
question.view.center = CGPointMake(self.view.center.x, self.view.center.y - 50);
[self addChildViewController:question];
[self.scrollView addSubview:question.view];
nextYposition = question.view.frame.origin.y + question.view.frame.size.height;
int questionHeight = 0; // Guardamos el alto dependiendo del tipo de control
if (self.sliderStyle) {
// Slider test
if (whiteStyle) {
NPSSliderViewControl = [[NPSSliderViewController alloc] initWithStyle:kNPSSliderViewStyleWhite];
} else {
NPSSliderViewControl = [[NPSSliderViewController alloc] initWithStyle:kNPSSliderViewStyleOther];
}
NPSSliderViewControl.iconSet = [[[OpinatManager sharedInstance] campanya] tipoIconos];
[NPSSliderViewControl setBadText:badText andGoodText:goodText];
[self addChildViewController:NPSSliderViewControl];
[self.scrollView addSubview:NPSSliderViewControl.view];
NPSSliderViewControl.delegate = self;
CGRect frame = NPSSliderViewControl.view.frame;
[NPSSliderViewControl.view setFrame:CGRectMake(0, nextYposition, frame.size.width, frame.size.height)];
questionHeight = frame.size.height - 33; // 33 es el valor de la parte que desaparece del control
} else {
// Control
if (whiteStyle) {
NPSBtnViewControl = [[NPSBtnViewController alloc] initWithStyle:kNPSBtnViewStyleWhite];
} else {
NPSBtnViewControl = [[NPSBtnViewController alloc] initWithStyle:kNPSBtnViewStyleOther];
}
NPSBtnViewControl.iconSet = [[[OpinatManager sharedInstance] campanya] tipoIconos];
[NPSBtnViewControl setBadText:badText andGoodText:goodText];
[self addChildViewController:NPSBtnViewControl];
[self.scrollView addSubview:NPSBtnViewControl.view];
NPSBtnViewControl.delegate = self;
CGRect frame = NPSBtnViewControl.view.frame;
[NPSBtnViewControl.view setFrame:CGRectMake(0, nextYposition, frame.size.width, frame.size.height)];
questionHeight = frame.size.height - 58; // 60 es el valor de la parte que desaparece del control
}
nextYposition += questionHeight;
// Motives question
if (whiteStyle) {
motivesQuestion = [[NPSQuestionViewController alloc] initWithQuestion:self.insatisfactionTitle AndStyle:kNPSQuestionStyleWhite];
} else {
motivesQuestion = [[NPSQuestionViewController alloc] initWithQuestion:self.insatisfactionTitle AndStyle:kNPSQuestionStyleOther];
}
CGRect secondQuestionFrame = motivesQuestion.view.frame;
secondQuestionFrame.origin.y = nextYposition;
motivesQuestion.view.frame = secondQuestionFrame;
motivesQuestion.view.alpha = 0;
[self.scrollView addSubview:motivesQuestion.view];
motivesQuestion.view.tag = 22;
questionHeight = motivesQuestion.view.frame.size.height;
nextYposition += questionHeight;
// Setting up table Y position. Only works if I setted in viewDidAppear
nextPosition = nextYposition;
resetPosition = nextYposition;
// Ajustamos la tableView
self.tableMotives.alpha = 0;
}
Есть идеи? благодаря!
Показать свой код для установки фреймов. Вы должны изменить смещения смещения ... – Wain
напишите свой код, что вы пробовали – codercat
@Wain, iDev Я выразился, спасибо. –