前面我们测试都通过的程序,昨天我修复了几个bug后做回归测试,突然发现了好几个bug,瞬间吓坏我了,差点就还原了版本,但我还是耐着性子找了,最后,也就是今天上午,我才定定位出问题所在,原来是升级IOS 7.1后,系统默认的好多组件啥的,逻辑方式发生下改变,也就是出现了些兼容性问题。
我发现的这个问题是UIButton的,我发现,当给一个button的enable设置为NO后,如果想再更新它的title,background,就没法更新。
兼容方案是:先恢复enable为YES,然后再更新,最后再还原。
类似代码:
/**
*传递实体和序号
**/
-(void)setEntity:(TripNode *)dataEntity andDayIndex:(int)index
{
self.dataEntity = dataEntity;
NSLog(@"index :%d",index);
self.leftOperationButton.enabled = YES;
if (self.style == TPUpdateTripBranchHeaderStyleTo) {
[self.leftOperationButton setTitle:[NSString stringWithFormat:@"D%d",index] forState:UIControlStateNormal];
self.leftOperationButton.enabled = NO;
}else if (self.style == TPUpdateTripBranchHeaderStyleAdd) {
[self.leftOperationButton setTitle:@"" forState:UIControlStateNormal];
} else if (self.style == TPUpdateTripBranchHeaderStyleFrom) {
[self.leftOperationButton setTitle:@"From" forState:UIControlStateNormal];
self.leftOperationButton.enabled = NO;
}else if (self.style == TPUpdateTripBranchHeaderStyleReturn) {
[self.leftOperationButton setTitle:@"Return" forState:UIControlStateNormal];
self.leftOperationButton.enabled = NO;
}
}
其他的几个兼容性问题我就不一一列举了,上stackoverflow上一搜关键字:
ios 7.1 not working
你就会发现一大大堆的类似问题:http://stackoverflow.com/search?q=ios+7.1+not+working
具体解决方案,自己根据个人情况找吧,祝你们好运!!