uiviewanimation

How to mimic UINavigation animation behavior when transitioning between two UITableViews

隐身守侯 提交于 2019-12-11 05:16:49
问题 I have a UIViewController that houses two UITableViews and swaps between the two. I'm wondering how can I implement the exact same animation behavior that a UINavigationController does when transitioning between these two UITableViews? (ie one tableView gets pushed off the screen left to right or right to left by the other tableView). 回答1: // Set table 2 up offscreen as starting state CGRect rect = tableView2.frame; rect.origin.x = rect.size.width; tableView2.frame = rect; // fill in any

Unable to simultaneously satisfy constraints when animating

て烟熏妆下的殇ゞ 提交于 2019-12-11 03:08:31
问题 I have six user constraints setup with IB that look like this: H:|-(593)-[UIView(411)]-(20)-| V:|-(20)-[UIView(288)]-(396)-| I grow and shrink the view by changing the constraints and then calling layoutIfNeeded. For example, to grow the view I will do: H:|-(20)-[UIView(984)]-(20)-| V:|-(20)-[UIView(663)]-(20)-| And then call [UIView animateWithDuration:.5 animations:^{ [self.view layoutIfNeeded]; }]; This technique grows and shrinks my view, and it looks nice, but I'm given a rather

UIView Animation not working to resize view

*爱你&永不变心* 提交于 2019-12-11 02:40:09
问题 I am using following code to animate the appearance of selectionMoreOptionView [selectionMoreOptionView setFrame:CGRectMake(974, 56, 50, 0)]; [self.view insertSubview:selectionMoreOptionView aboveSubview:lightBoxView]; [lightBoxView setAlpha:0.0]; [UIView animateWithDuration:5.0 delay:0.0 options:UIViewAnimationOptionCurveLinear animations:^{ [lightBoxView setAlpha:0.5]; [selectionMoreOptionView setFrame:CGRectMake(974, 56, 50, 100)]; } completion:^(BOOL finished) { }]; But it is not

UIViewAnimationOptionAllowUserInteraction not working

。_饼干妹妹 提交于 2019-12-10 23:56:52
问题 I'm trying to detect a touch whilst my UIImageView is animating. The touch detection works before the animation starts, and once it stops, but not during. I've tried adding UIViewAnimationOptionAllowUserInteraction , but it seems to have no effect at all! Could anyone point me in the right direction? Code: -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *touch = [touches anyObject]; NSLog(@"tag=%@", [NSString stringWithFormat:@"%i", touch]); if ([touch view] ==

How can I stop an UIViewAnimationOptionRepeat UIView Animation?

故事扮演 提交于 2019-12-10 21:27:05
问题 I have the following code inside of a UIView subclass: [element setAlpha: 0.0f]; [UIView animateWithDuration: 0.4 delay: 0.0 options: UIViewAnimationOptionCurveEaseOut | UIViewAnimationOptionAutoreverse | UIViewAnimationOptionRepeat animations: ^{ [element setAlpha: 1.0f]; } completion: ^(BOOL finished){ if (finished) { return; } }]; Then when I want to stop the Animation I send the following message to the View itself: [[self layer] removeAllAnimations]; But it does nothing... How can I stop

UIView transitionWithView & setting the frame no longer works iOS8

人盡茶涼 提交于 2019-12-10 20:52:36
问题 Since updating to iOS8 many animations have stopped working. It appears that the y position of the view cannot be changed. In iOS7 there was no problem. But with iOS8 it will not go past the original y position.It appears that the frame of the view are indeed being updated but the frame is not being redrawn. Here is my code [UIView transitionWithView:self.view duration:0.3 options:UIViewAnimationOptionCurveEaseInOut animations:^{ self.table.frame = CGRectMake(0, (self.view.bounds.size.height

UIView animated backgroundColor with drawRect:

喜夏-厌秋 提交于 2019-12-10 19:06:58
问题 I have a view that is able to draw a rect on itself. It is actually a subclass of UICollectionView but I'm just struggling with UIView specific stuff; the backgroundColor. I simply added a UIPanGestureRecognizer , saved the start point at UIGestureRecognizerStateBegan and the end point at UIGestureRecognizerStateChanged . I then use the -drawRect: method to draw the actual path: - (void)awakeFromNib { UIPanGestureRecognizer *pan = [[UIPanGestureRecognizer alloc] initWithTarget:self action:

Changing UIView background color using an animation

 ̄綄美尐妖づ 提交于 2019-12-10 15:57:10
问题 I want to change my UIView background color with a transition animation. For example, if the view is red and I change it to blue. The blue color will slide up from the bottom of the screen to the top and fill the whole screen. I was thinking of doing this by making a UIView of identical size with the desired color and then animating it from off screen up to the top. This doesn't seem like a very elegant way to do it though. Is there any better way of doing this? Any points would be really

objective-c: executing multiple transitionWithView animation blocks

馋奶兔 提交于 2019-12-10 04:59:10
问题 I'm trying to make a simple Simon game (an increasing sequence of colors flash and the user has to try to repeat that sequence). The way I'm going about it is by having 4 UIViews with 8 images. So there's a UIView for red, blue, green, and yellow. And I have gifs of dark green, light green, dark red, light red, etc. So in my code, I'm using UIView's transitionWithView animation block: The UIView imageView.image is defaulted to the dark color image and this block is transitioning to light

UITextView animating change of frame does not animate text reallocation

只谈情不闲聊 提交于 2019-12-09 16:53:23
问题 I have a UITextView, and I am trying to animate a change of frame when the user taps on a button. Basically the text view grows larger to fit the screen so it can display more text, and then when the user taps the button again it shrinks to its original frame. I perform the animation using blocks, like this: if(!isDisplayingDetailView) { //Expand view [UIView animateWithDuration:0.5 animations:^{ self.detailView.frame = self.view.frame; } completion:^(BOOL finished){ isDisplayingDetailView =