animatewithduration

animateWithDuration:animations:completion: in Swift

别来无恙 提交于 2019-12-28 22:16:09
问题 In objective-C my animation bit would look something like this: [UIView animateWithDuration:0.5 animations:^{ [[[_storedCells lastObject] topLayerView] setFrame:CGRectMake(0, 0, swipeableCell.bounds.size.width, swipeableCell.bounds.size.height)]; } completion:^(BOOL finished) { [_storedCells removeLastObject]; }]; If I translate that into Swift it should look something like this: UIView.animateWithDuration(0.5, animations: { self.storedCells[1].topLayerView.frame = CGRectMake(0, 0, cell

UIView.animateWithDuration not animating

邮差的信 提交于 2019-12-24 01:01:35
问题 The UIView.animateWithDuration call in my ViewController viewDidLoad function does not animate. The completion block gets called immediately. The println output shows 'completion true'. Is the viewDidLoad function the wrong place to put my startup animation? Any hints are greatly appreciated. class ViewController: UIViewController { @IBOutlet var beatIndicator:UIView? override func viewDidLoad() { super.viewDidLoad() if let led = beatIndicator? { led.alpha = 1.0 led.frame = CGRectMake(20, 20,

UIView AnimateWithDuration Never Reaches Completion Block

故事扮演 提交于 2019-12-12 18:26:50
问题 I have this bit of code that I use to switch the root view controller with a nice little animation, it had been working for months... but then randomly stopped working. UIView snapshot = [self.window snapshotViewAfterScreenUpdates:YES]; [viewController.view addSubview:snapshot]; self.window.rootViewController = viewController; NSLog(@"check point 1"); [UIView animateWithDuration:0.3 animations:^{ NSLog(@"check point 2"); snapshot.layer.opacity = 0; NSLog(@"check point 3"); snapshot.layer

Animate a change with NSTextAlignment of UITextField using Swift

岁酱吖の 提交于 2019-12-12 01:56:56
问题 I am curious if it is possible to animate a change in a UITextField's text alignment. Basically I have a UITextField that's alignment is normally set to center, and I want it to animate over to the left when the user starts editing. Here is the code that I've tried within the UITextField Delegate Methods: func textFieldDidBeginEditing(textField: UITextField) { UIView.animateWithDuration(0.5, delay: 0, options: UIViewAnimationOptions.CurveEaseInOut, animations: { self.titleField.textAlignment

UIView animating one constraint affects another constraint

时间秒杀一切 提交于 2019-12-11 03:35:32
问题 I have an UIImageView that I want to animate slowly with a pan effect at the background. My background image view has four constraints: Distance from top to top layout guide (zero) Distance from bottom to bottom layout guide (zero) Width (constant at 850) Leading space to superview (zero, connected to code as backgroundImageViewLeftMargin outlet) The image view's view mode is set to "aspect fill". When I run my app, there is no problem, the static image is displayed. I add the following code

Weird behaviour happens when using UIView animate and CGAffineTransform

巧了我就是萌 提交于 2019-12-10 10:52:58
问题 I created some animations in my project. Basically, I use UIView animate and CGAffineTransform, but a very strange thing happened and I have no idea. Hope someone can help me solve this problem. Thanks in advance. This is the strange thing: After the user clicks on a button, the button slides off screen and another two buttons slide on the screen (I just changed the center point of these buttons to achieve this animation). And, some time later, a view on the screen start shaking (I use

swift UIView animateWithDuration with repeat and autoreverse

不想你离开。 提交于 2019-12-08 04:31:57
问题 I am new to swift and this is my first question ever .... I would like to shrink a ball with duration 2 seconds, and then grow it for a duration of 5 seconds. My problem is that the second duration is ignored (ball shrinks for 2 seconds and grows for 2 seconds). I hope someone can help me. This is my attempt: let ball = UIView() ball.frame = CGRectMake(50, 50, 50, 50) ball.backgroundColor = UIColor.blueColor() ball.layer.cornerRadius=25 relaxContainer.addSubview(ball) UIView

UITableView Drag & Drop Outside Table = Crash

百般思念 提交于 2019-12-07 07:03:28
问题 The Good My drag & drop function almost works wonderfully. I longPress a cell and it smoothly allows me to move the pressed cell to a new location between two other cells. The table adjusts and the changes save to core data. Great! The Bad My problem is that if I drag the cell below the bottom cell in the table, even if I don't let go (un-press) of the cell... the app crashes. If I do the drag slowly, really it crashes as the cell crosses the y-center of the last cell... so I do think it's a

Animate hidden property on UILabels in UIStackView causes different animations

折月煮酒 提交于 2019-12-07 06:33:35
问题 UIStackView makes it really easy to create a nice animation using the hidden property of a UIView. I have two UIStackViews each with UILabels in the arrangedSubviews and when I add a new UILabel to a UIStackView , it should present it with an animation of the label appearing at the correct index, pushing the labels above and below it. This effect is very easy to do using UIStackViews : descriptionLabel.hidden = true let count = descriptionStack.arrangedSubviews.count descriptionStack