내 UI를 업데이트하는 데 이상한 문제가 있습니다. 아래 코드에서 "Section 1"과 "Section 2"로 언급 한 것을 차단하는 주석을 작성했습니다. 아무리해도 제 1 절은 완벽하게 작동하고 애니메이션을 커밋합니다. 그러나 코드에서 1 절이 있으면 2 절이 작동하지 않습니다. 프레임은 설정되어 있지만 애니메이션이 실행되지 않습니다 그것은 고정 유지iOS UITextField 프레임이 적용되지 않습니다.
나는 두 부분이있을 때 그렇습니다이 : http://cl.ly/image/2p3H0x3n3W1F/Screenshot%202014.02.10%2014.07.54.png
때 (스테퍼 아래의 텍스트 필드가 움직이지 않는 방법주의) 난 그냥 2 장을 가지고이를 위해 : http://cl.ly/image/2H0C1p2M1M37/Screenshot%202014.02.10%2014.07.32.png (스텝퍼 이동 정확히하지만, 섹션 1은 중간 텍스트 필드 생성되지 존재하지 않기 때문에) 이미 확인했다
것들 :
을- 내가 나타났습니다 (그렇지 않은)
내가 메인 스레드 (내가)
가 [애니메이션 블록]
2014-02-10 14:15:38.253 traffic[1163:60b] animatedBegin frame: {{20, 20}, {280, 30}}
2014-02-10 14:15:38.253 traffic[1163:60b] animatedMid frame: {{20, 95}, {280, 30}}
2014-02-10 14:15:38.254 traffic[1163:60b] animatedMid frame: {{20, 140}, {280, 30}}
2014-02-10 14:15:38.254 traffic[1163:60b] animatedEnd frame: {{20, 185}, {280, 30}}
가 [완료 블록]
2014-02-10 14:15:38.508 traffic[1163:60b] Begin frame: {{20, 20}, {280, 30}}
2014-02-10 14:15:38.509 traffic[1163:60b] Mid frame: {{20, 95}, {280, 30}}
2014-02-10 14:15:38.511 traffic[1163:60b] Mid frame: {{20, 140}, {280, 30}}
2014-02-10 14:15:38.512 traffic[1163:60b] End frame: {{20, 95}, {280, 30}}
목표는
endAddressText 필드가 웨이 포인트 아래로 이동하도록합니다..H
@interface CreateCustomRouteViewController : UIViewController{
__weak IBOutlet UITextField *startAddressTextfield;
NSMutableArray* waypointTextfields;
__weak IBOutlet UIStepper *waypointStepper;
__weak IBOutlet UITextField *endAddressTextfield;
}
- (IBAction)waypointStepperValueChanged:(id)sender;
@end
하는 .m
#import "CreateCustomRouteViewController.h"
@interface CreateCustomRouteViewController()
@end
@implementation CreateCustomRouteViewController
- (void)viewDidLoad {
[super viewDidLoad];
waypointTextfields = [[NSMutableArray alloc] init];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
}
- (IBAction)waypointStepperValueChanged:(UIStepper*)sender {
[UIView animateWithDuration:0.25 animations:^{
CGRect frame;
//beginSection1
if ([waypointTextfields count] > sender.value){
[[waypointTextfields lastObject] removeFromSuperview];
[waypointTextfields removeLastObject];
}else{
frame = startAddressTextfield.frame;
frame.origin.y = 50.0f + (sender.value) * 45.0f;
UITextField* tmp = [[UITextField alloc] initWithFrame:frame];
tmp.borderStyle = UITextBorderStyleRoundedRect;
tmp.backgroundColor = [UIColor greenColor];
tmp.alpha = 0.25f;
[self.view addSubview:tmp];
[waypointTextfields addObject:tmp];
}
//endSection1
//startSection2
frame = endAddressTextfield.frame;
frame.origin.y = 95.0f + (sender.value) * 45.0f;
endAddressTextfield.frame = frame;
//endSection2
}];
}
@end
스토리 :
http://cl.ly/image/3d3f2M2d370g/Screen%20Shot%202014-02-10%20at%202.02.46%20PM.png
출구 :
http://cl.ly/image/0U2M2f202B3S/Screen%20Shot%202014-02-10%20at%202.11.44%20PM.png