這裏是奇怪的事情, 我正在移動UIView位置的代碼,它在ios7中完美工作,但在ios8動畫重置動畫,即使我chaning任何標籤在控制器中的文本,這真的很適合我[UIView animateWithDuration動畫更改後更改標籤文本
if (!self.setTouch) {
[UIView animateWithDuration:kViewAnimateWithDuration
delay:kViewDelay
options:UIViewAnimationOptionCurveEaseInOut |
UIViewAnimationOptionAllowUserInteraction
animations:^{
//Move frame or transform view
[self.sliderView setFrame:CGRectMake(self.sliderView.frame.origin.x,-205,self.sliderView.frame.size.width,249)];
self.setTouch = YES;
// [self.containerView setFrame:CGRectMake(self.bottomView.frame.origin.x, self.bottomView.frame.origin.y +171, width_b, height_b -171)];
} completion:^(BOOL finished) {
self.setTouch = YES;
}];
} else {
[UIView animateWithDuration:kViewAnimateWithDuration
delay:kViewDelay
options:UIViewAnimationOptionCurveEaseInOut |
UIViewAnimationOptionAllowUserInteraction
animations:^{
[self.sliderView setFrame:CGRectMake(self.sliderView.frame.origin.x,0.0f,self.sliderView.frame.size.width,249.0)];
self.setTouch = NO;
} completion:^(BOOL finished) {
self.setTouch = NO;
}];
}
這裏奇怪的是,這改變標籤文本代碼:
NSTimer *timer= [NSTimer scheduledTimerWithTimeInterval:5.0 target:self
selector:@selector(change_announcement:) userInfo:nil repeats:YES];
下面是實際的方法:
(IBAction)change_announcement:(id)sender {
if ([_announcements count] == 0) {
return;
}
AnnouncementDAO *ob = [_announcements objectAtIndex:_index];
if(_isArabic){
// [_label_announcementEn setHidden:YES];
//[_label_announcementAr setHidden:NO];
[_label_announcementAr setText:ob.announcementArabicTitle];
} else{
// [_label_announcementAr setHidden:YES];
// [_label_announcementEn setHidden:NO];
[_label_announcementEn setText:ob.announcementEngTitle];
}
if (_index >= [_announcements count]-1) {
// NSLog(@"Make index 0");
_index = -1;
}
_index ++;
}
當我的NSLog sliderView限制,我看到下面的輸出:
"<NSIBPrototypingLayoutConstraint:0x7b048740 'IB auto generated at build time for view with fixed frame' H:|-(0)-[UIView:0x7b04b6a0](LTR) (Names: '|':UIView:0x7b04b710)>",
"<NSIBPrototypingLayoutConstraint:0x7b048710 'IB auto generated at build time for view with fixed frame' V:|-(0)-[UIView:0x7b04b6a0] (Names: '|':UIView:0x7b04b710)>",
"<NSIBPrototypingLayoutConstraint:0x7b0486e0 'IB auto generated at build time for view with fixed frame' H:[UIView:0x7b04b6a0(768)]>",
"<NSIBPrototypingLayoutConstraint:0x7b0486b0 'IB auto generated at build time for view with fixed frame' V:[UIView:0x7b04b6a0(25)]>",
"<NSIBPrototypingLayoutConstraint:0x7b048680 'IB auto generated at build time for view with fixed frame' H:|-(348)-[UIButton:0x7b0e72b0](LTR) (Names: '|':UIView:0x7b04b710)>",
"<NSIBPrototypingLayoutConstraint:0x7b048650 'IB auto generated at build time for view with fixed frame' V:|-(206)-[UIButton:0x7b0e72b0] (Names: '|':UIView:0x7b04b710)>",
"<NSIBPrototypingLayoutConstraint:0x7b048620 'IB auto generated at build time for view with fixed frame' H:[UIButton:0x7b0e72b0(73)]>",
"<NSIBPrototypingLayoutConstraint:0x7b0485f0 'IB auto generated at build time for view with fixed frame' V:[UIButton:0x7b0e72b0(22)]>",
"<NSIBPrototypingLayoutConstraint:0x7b0485c0 'IB auto generated at build time for view with fixed frame' H:|-(0)-[UIView:0x7b04d690](LTR) (Names: '|':UIView:0x7b04b710)>",
"<NSIBPrototypingLayoutConstraint:0x7b048590 'IB auto generated at build time for view with fixed frame' V:|-(25)-[UIView:0x7b04d690] (Names: '|':UIView:0x7b04b710)>",
"<NSIBPrototypingLayoutConstraint:0x7b048560 'IB auto generated at build time for view with fixed frame' H:[UIView:0x7b04d690(768)]>",
"<NSIBPrototypingLayoutConstraint:0x7b048530 'IB auto generated at build time for view with fixed frame' V:[UIView:0x7b04d690(181)]>"
什麼代碼看起來像你用來改變文本? – Flexicoder 2014-10-22 10:28:29
編輯UILabel文本現在添加 – Ali 2014-10-22 10:37:42