Wednesday, 14 August 2013

UITextField - not set new frame (at animation)

UITextField - not set new frame (at animation)

I want, that searchField deformation to targetFrame.
#1 This not result:
- (BOOL)searchBarShouldBeginEditing:(UISearchBar *)bar
{
UITextField *searchField = [bar valueForKey:@"_searchField"];
CGRect targetFrame = CGRectMake(-50, 0, 200, 30);
searchField.frame = targetFrame; //not result
return YES;
}
#2 Incorrect, but transform:
- (BOOL)searchBarShouldBeginEditing:(UISearchBar *)bar
{
UITextField *searchField = [bar valueForKey:@"_searchField"];
searchField.frame = CGRectMake (10, 0, 200, 50); //must differ from
CGRectZero
[UIView animateWithDuration: 3.0
animations: ^{
CGRect targetFrame = CGRectMake(-50, 0, 200, 30);
searchField.frame = targetFrame;
}];
return YES;
}
Then using #2, searchField start animation, but to default size (not to
targetFrame).
I want, that searchField transform to targetFrame.
PS
searchField.autoresizingMask = UIViewAutoresizingNone; not result

No comments:

Post a Comment