uiviewanimation

How to force a raw value of 7 into a UIViewAnimationCurve enum?

£可爱£侵袭症+ 提交于 2019-12-05 01:43:30
The key UIKeyboardAnimationCurveUserInfoKey in the userInfo dictionary of a UIKeyboardWillShowNotification contains an Int with the value 7 . Now I need to pass this Int into UIView.setAnimationCurve(<here>) . I tried to create the required UIViewAnimationCurve enum like this UIViewAnimationCurve(rawValue: 7) . Because the raw value 7 is undocumented, the result is always nil . It works fine this way in Objective-C. Any idea how to get this animation curve from the notification into a UIView animation using Swift? Update: As pointed out by Martin, this is no longer a problem since Xcode 6.3.

UIButton inside a UIView not working after UIView is animated

↘锁芯ラ 提交于 2019-12-05 00:56:23
I have seen many questions in this forum which gives answer to this topic "UIButton inside a UIView, when animated doesn't work", but after having tried out the answers like a) UIViewAnimationOptionAllowUserInteraction to the options b) subView.setUserInteractionEnabled = YES c) [button addTarget:self action:@selector(buttonPressed) forControlEvents:UIControlEventTouchUpInside]; none of them is working for me :-( Here is the scenario. App is in landscape mode and a UIView called menuView is placed at x=480,y=0. Its height=200 and width=150. So, when I tap the button on the top right corner,

Objective-C: How to animate “Loading…” text on a UILabel

ぐ巨炮叔叔 提交于 2019-12-04 22:07:16
In my app I need to display a "Loading" text in an UILabel, repeatedly as follows: Loading Loading. Loading.. Loading... Loading Loading. Loading.. Loading... How can I do it? Any suggestion, please? You could easily implement such a behavior yourself – see my example below. But like trojanfoe suggested, I would rather use a nice library like MBProgressHUD or MarqueeLabel - (void) updateLoadingLabel; { if(self.loading) { if([self.labelLoading.text isEqualToString:@"Loading…"]) { self.labelLoading.text = @"Loading"; } else { self.labelLoading.text = [NSString stringWithFormat:@"%@.",self

Multiple UIView Animations

送分小仙女□ 提交于 2019-12-04 21:48:28
I am trying to perform multiple UIView animations one after the other. However, I've heard that it's bad practice to perform multiple UIView animations one after the other, and that I should instead use Core Animation. I tried this code: //First Animation [UIView beginAnimations:@"animation1" context:nil]; [UIView setAnimationDuration:2]; nwView.backgroundColor = [UIColor redColor]; nwView.frame = CGRectMake(CGRectGetMidX(screenSize), CGRectGetMinY(screenSize), width, height); nwView.transform = CGAffineTransformMakeRotation(45.0f); [UIView commitAnimations]; //Second Animation [UIView

iOS curl up animation to remove uiimageview

混江龙づ霸主 提交于 2019-12-04 14:45:47
i'm looking to remove an image from my app with a curl up animation. I've got [UIView transitionWithView:sender.view.superview duration:1.5 options:UIViewAnimationOptionTransitionCurlUp animations:^ { [sender.view removeFromSuperview]; } completion:nil]; but this curls the entire page away and looks as though there's a separate page beneath without the image on it. Instead of a 'transition' to a new page is it possible to curl the image off the page without affecting the rest of the page? Do I need to wrap the imageview in a 'container view' and change transition with view to that? Your view

Multiple Simultaneous UIViewAnimations on a Single UIView

孤街醉人 提交于 2019-12-04 10:25:30
Goal : Have several animations play at the same time on a single UIView. Problem : From what I can tell, this is not possible. Each animation has to occur in sequence and cannot overlap. In essence, I want a single UIView to animate vertically while animating horizontally at the same time. Since I'm using UIViewAnimationOptionRepeat , I cannot nest any other animation in onCompletion: Here's what I want to work but doesn't: [UIView animateWithDuration:duration delay:kANIMATION_DELAY options:UIViewAnimationOptionCurveEaseInOut | UIViewAnimationOptionRepeat | UIViewAnimationOptionAutoreverse

Swift 3 UIView animation

橙三吉。 提交于 2019-12-04 10:06:25
问题 Since upgrading my project to swift 3 my autolayout constraint animations aren't working; to be more specific, they're snapping to the new position rather than animating. UIView.animate(withDuration: 0.1, delay: 0.1, options: UIViewAnimationOptions.curveEaseIn, animations: { () -> Void in constraint.constant = ButtonAnimationValues.YPosition.DefaultOut() self.layoutIfNeeded() }, completion: { (finished) -> Void in // .... }) I know they added the UIViewPropertyAnimator class but am yet to try

Highlighting a UIView similar to UIButton

你。 提交于 2019-12-04 08:40:17
问题 I have a UIView with a number of subviews and a Tap gesture recognized associated and I want to mimic it having a 'touch' effect. That is, when the tap happens, I want to show the container view to have a different background color and the text of any subview UILabels to also look highlighted. When I receive the tap event from UITapGestureRecognizer, I can change the background color just fine and even set the UILabel to [label setHighlighted:YES]; For various reasons, I cannot change the

Hidden property cannot be changed within an animation block

妖精的绣舞 提交于 2019-12-04 08:34:08
问题 I've got two UILabels embedded within a UIStackView. The top label stays visible constantly, but the bottom label is toggled on and off via the hidden property. I wanted this effect to be animated, so I stuck it in an animation block: private func toggleResultLabel(value:Double) { if value == 0 { UIView.animateWithDuration(0.25) { () -> Void in self.resultLabel.hidden = true } } else { UIView.animateWithDuration(0.25) { () -> Void in // Something weird is happening. I had to add 3 of the same

UITextView animating change of frame does not animate text reallocation

依然范特西╮ 提交于 2019-12-04 05:59:56
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 = YES; }]; } else{ //Shrink view. [UIView animateWithDuration:0.5 animations:^{ self.detailView.frame =