uiviewanimation

Why are animations on bounds of an UILabel only working when increasing the size?

爷,独闯天下 提交于 2019-11-27 05:42:44
问题 I noticed that when i change the bounds of an UILabel in an animation block it only works if i increase the size, when i decrease the size the UILabel just changes his size but doesn't animate. Replacing the UILabel with a plain UIView works as intended. Note: Changing the contentMode property of the UILabel to UIViewContentModeScaleToFill fixes this issue, but i still don't understand why it works when increasing the size without changing the contentMode property. #import "FooView.h"

How to animate a UIView with constraints in Swift?

蓝咒 提交于 2019-11-27 05:31:32
问题 In my contrived example, I have the following single view: As you can see, it consists of a few simple constraints: Align horizontal and vertical centers, Height (set to a constant) Leading and trailing spaces (set to constant) What I'm seeking to achieve is to have this redish/pinkish view "come in" from the top. Traditionally, in a constraint-less world, I would simply modify the frame inside of UIView.animateWithDuration , however I'm not sure how I do the similar in a constraint world. To

How to switch automatically between viewPager pages

*爱你&永不变心* 提交于 2019-11-27 04:37:24
I have an android application that employs a ViewPager with two pages When the activity first displays i would like to present each page in turn to the user so that they know they can swipe between to two views. I have failed to find any docs describing how to do this. I have discovered PageTransformations which sounded promising but the user has to swipe first. I need my two pages to scroll automatically as soon as the first page in the ViewPager displays. how can a achieve the desired result? Shajeel Afzal You can use Timer for this purpose. The following code is self explanatory: // -------

How to make half curl animation in iPhone like the maps app?

a 夏天 提交于 2019-11-27 04:27:24
问题 I am using the following code for page curl animation [UIView beginAnimations:@"yourAnim" context:nil]; [UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:yourView cache:cacheFlag]; ... [UIView commitAnimations]; Is it possible to make the half curl animation like the maps.app on iphone/ipod ? Any ideas how to make an similar effect ? Thanks 回答1: Apple does support this for the presentation of modal views as of 3.2. This makes sense: the page curl effect is intended to

UIView animateWithDuration doesn't animate cornerRadius variation

随声附和 提交于 2019-11-27 03:29:27
I'm trying to animate the change of the cornerRadius of a UIView instance layer , but the variation of the cornerRadius takes place immediately. Here's the code: UIView *view = [[UIView alloc] initWithFrame:CGRectMake(10, 10, 100, 100)]; view.layer.masksToBounds = YES; view.layer.cornerRadius = 10.0; [UIView animateWithDuration:1.0 animations:^{ [view.layer.cornerRadius = 0.0; }]; Thanks everybody who is going to give me any tips. EDIT: I managed to animate this property using Core Animation , using a CABasicAnimation . CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@

Android custom animation like airport schedule board

。_饼干妹妹 提交于 2019-11-27 02:52:42
问题 I want to create an animation for the text like on Airport the flight schedule board does. Dropping from top and change the text on it. Here is the image. So When I click on button the text on the image should change with the said animation. Does it possible with android? Please guide me how can I achieve this kind of animation in android? EDIT: <?xml version="1.0" encoding="utf-8"?> <animation-list xmlns:android="http://schemas.android.com/apk/res/android" android:oneshot="false"> <item

Animate nav bar title text change

∥☆過路亽.° 提交于 2019-11-27 01:26:36
问题 In my app, I have a page view controller that allows the user to swipe between different "sections" of the app, and at the top in the nav bar I change the title text to the new section the user has swiped to via pageViewController:didFinishAnimating:previousViewControllers:transitionCompleted: . It is currently instantly changing the title text when the animation has completed. I would like to improve this with some animation, a subtle fading in and out effect. I first tried to implement

Test whether a UIView is in the middle of animation

久未见 提交于 2019-11-27 01:23:54
Is there any way to tell if a UIView is in the middle of an animation? When I print out the view object while it is moving I notice that there is an "animations" entry: search bar should end editing: <UISearchBar: 0x2e6240; frame = (0 0; 320 88); text = ''; autoresize = W+BM; animations = { position=<CABasicAnimation: 0x6a69c40>; bounds=<CABasicAnimation: 0x6a6d4d0>; }; layer = <CALayer: 0x2e6e00>> When the animation has stopped and I print the view, the "animations" entry is now gone: search bar should end editing: <UISearchBar: 0x2e6240; frame = (0 0; 320 88); text = ''; autoresize = W+BM;

How to properly animate UIScrollView contentOffset

吃可爱长大的小学妹 提交于 2019-11-27 01:07:54
问题 I have UIScrollView subclass. Its content is reusable - about 4 or 5 views are used to display hundreds of elements (while scrolling hidden objects reused and jumps to another position when its needed to see them) What i need: ability to automatically scroll my scroll view to any position. For example my scroll view displays 4th, 5th and 6th element and when I tap some button it needs to scroll to 30th element. In other words I need standard behaviour of UIScrollView. This works fine: [self

UIView animation jumps at beginning

僤鯓⒐⒋嵵緔 提交于 2019-11-26 22:53:08
问题 I'm running this code... [UIView animateWithDuration:0.2 delay:0.0 options:UIViewAnimationOptionCurveEaseOut animations:^{ CGAffineTransform settingsTransform = CGAffineTransformMakeTranslation(self.settingsView.frame.size.width, 0); CGAffineTransform speedTransform = CGAffineTransformMakeTranslation(-self.speedView.frame.size.width, 0); self.settingsView.transform = settingsTransform; self.speedView.transform = speedTransform; } completion:nil]; But when it runs the views jump half the