回答:私は私の質問の理由を発見した
:
それは私がcompletion block
にそれらのコードを置き換え、その問題が解決している間違った場所、 が表示されますので、私は、uiview animation
前にそのコードを実行します。
- (void)show{
if (self.isOpenState == YES) {
return;
}
[UIView animateWithDuration:0.3 animations:^{
//CGRect frame = self.backOfTabAndTrailer.frame;
self.opacity_back.alpha = 0.2;
//frame.size.height = _rowHeight * _numberOfRow;
//[self.backOfTabAndTrailer setFrame:frame];
self.backOfTabAndTrailer.frame = CGRectMake(_backOfTabAndTrailer.frame.origin.x, _backOfTabAndTrailer.frame.origin.y, _backOfTabAndTrailer.frame.size.width, _rowHeight * _numberOfRow);
self.tab_province.frame = CGRectMake(self.tab_province.frame.origin.x, self.tab_province.frame.origin.y, self.tab_province.frame.size.width, _rowHeight * _numberOfRow);
self.tab_city.frame = CGRectMake(self.tab_city.frame.origin.x, self.tab_city.frame.origin.y, self.tab_city.frame.size.width, _rowHeight * _numberOfRow);
self.tab_country.frame = CGRectMake(self.tab_country.frame.origin.x, self.tab_country.frame.origin.y, self.tab_country.frame.size.width, _rowHeight * _numberOfRow);
self.trailerView.frame = CGRectMake(_backOfTabAndTrailer.frame.origin.x, _rowHeight * _numberOfRow, self.trailerView.frame.size.width, Height_Of_Trailer);
self.trailerImage.frame = CGRectMake(_allFrame.size.width/2 - Height_Of_Trailer/2, 0, Height_Of_Trailer, Height_Of_Trailer);
self.trail_line.frame = CGRectMake(self.backOfTabAndTrailer.frame.origin.x, 0, self.trail_line.frame.size.width, 1);
self.trailerButton.frame = CGRectMake(self.backOfTabAndTrailer.frame.origin.x, 0, self.trailerButton.frame.size.width, 1);
} completion:^(BOOL finished){
self.isOpenState = YES;
/* 让tabview滚到被选中的地方 */
if (![self.provinceLabel.text isEqualToString:@""] && dataOfProvince.count != 0) {
for (int i = 0; i < dataOfProvince.count; i ++) {
if ([dataOfProvince[i] isEqualToString:self.provinceLabel.text]) {
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:i inSection:0];
[_tab_province selectRowAtIndexPath:indexPath animated:YES scrollPosition:UITableViewScrollPositionMiddle];
}
}
}
if (![self.cityLabel.text isEqualToString:@""] && dataOfCity.count != 0) {
for (int i = 0; i < dataOfCity.count; i ++) {
if ([dataOfCity[i] isEqualToString:self.cityLabel.text]) {
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:i inSection:0];
[_tab_city selectRowAtIndexPath:indexPath animated:YES scrollPosition:UITableViewScrollPositionMiddle];
}
}
}
if (![self.countryLabel.text isEqualToString:@""] && dataOfCountry.count != 0) {
for (int i = 0; i < dataOfCountry.count; i ++) {
if ([dataOfCountry[i] isEqualToString:self.countryLabel.text]) {
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:i inSection:0];
[_tab_country selectRowAtIndexPath:indexPath animated:YES scrollPosition:UITableViewScrollPositionMiddle];
}
}
}
}];
}
出典
2016-06-29 12:03:02
lme