シンプルなボタンでサイズを変更し、その後のクリックで拡大してから縮小しようとしています。
多少は機能しますが、フリップ後の最後のボタンは正しく見えます。円形でサイズが異なります。問題は、移行中に、この奇妙な非円形の効果が得られることです。この問題の視覚的な説明については、このリンクを参照してください-> http://screencast.com/t/rJaSJ0nGq。
移行をスムーズにし、常に円形に見えるようにするにはどうすればよいですか?スクリーンキャストにある丸みを帯びた長方形の外観は必要ありません。
これが私のボタンクリックの方法です:
// Handle when a user presses the button
- (IBAction)bubblePressed:(id)sender {
// Expand the bubble if it's pressed or de-expand it if
// already expanded
if ( buttonResized ) {
CGRect tempFrame=self.expandMe.frame;
tempFrame.size.width=100;//change acco. how much you want to expand
tempFrame.size.height=100;
[UIView beginAnimations:@"" context:nil];
[UIView setAnimationDuration:BUTTON_FLIP_TIME];
self.expandMe.frame=tempFrame;
// Round the buttons
self.expandMe.clipsToBounds = YES;
self.expandMe.layer.cornerRadius = self.expandMe.frame.size.width / 2;//half of the width
self.expandMe.layer.borderColor=[UIColor clearColor].CGColor;
self.expandMe.layer.borderWidth=2.0f;
// Flip the button
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:self.expandMe cache:YES];
[UIView commitAnimations];
}
else {
CGRect tempFrame=self.expandMe.frame;
tempFrame.size.width=200;//change acco. how much you want to expand
tempFrame.size.height=200;
[UIView beginAnimations:@"" context:nil];
[UIView setAnimationDuration:BUTTON_FLIP_TIME];
self.expandMe.frame=tempFrame;
// Round the buttons
self.expandMe.clipsToBounds = YES;
self.expandMe.layer.cornerRadius = self.expandMe.frame.size.width / 2;//half of the width
self.expandMe.layer.borderColor=[UIColor clearColor].CGColor;
self.expandMe.layer.borderWidth=2.0f;
// Flip the button
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:self.expandMe cache:YES];
[UIView commitAnimations];
}
// Flip the variable that tracks flipping
buttonResized = !buttonResized;
}