uiviewanimation

Animating an image view to slide upwards

浪子不回头ぞ 提交于 2019-11-26 14:41:36
I am attempting to make an image view ( logo below) slide upwards by 100 pixels. I am using this code, but nothing happens at all: [UIView beginAnimations:nil context:nil]; [UIView setAnimationDuration:3]; logo.center = CGPointMake(logo.center.x, logo.center.y - 100); [UIView commitAnimations]; This code is in the viewDidLoad method. Specifically, the logo.center = ... is not functioning. Other things (like changing the alpha) do. Maybe I'm not using the right code to slide it upwards? For non-autolayout storyboards/NIBs, your code is fine. By the way, it's now generally advised that you

UIView animateWithDuration doesn't animate cornerRadius variation

人走茶凉 提交于 2019-11-26 12:38:56
问题 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

iOS Segue - Left to Right -

只谈情不闲聊 提交于 2019-11-26 11:58:42
问题 I\'ve read the other posts on segues but none solve my question. Simply put, my ViewController s are ordered, like a book. I want backward transitions (example: from page 9 to 8) to always present (slide over) from left to right. I want forward transitions (from page 9 to 10) to present from right to left. Yes, my nav-controller back button (top left) presents like this if you are paging through page by page. However, if you jump in from an Index then the back function on the nav controller

How to switch automatically between viewPager pages

你。 提交于 2019-11-26 11:17:31
问题 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

How to flip an individual UIView (without flipping the parent view)

二次信任 提交于 2019-11-26 07:28:50
问题 This is an iPad project where I have a UIView with several subViews, and I am trying to animate one of this UIViews using [UIView transitionFromView:toView:duration:options:completion], but when I run this method the whole parent view gets flipped! This is the code I\'m using: UIView *secondView = [[UIView alloc] initWithFrame:CGRectMake(200, 200, 300, 300)]; [newView setBackgroundColor:[UIColor redColor]]; [UIView transitionFromView:self.firstView.view toView:secondView duration:1.0 options

How can I pop a view from a UINavigationController and replace it with another in one operation?

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-26 06:56:03
问题 I have an application where I need to remove one view from the stack of a UINavigationController and replace it with another. The situation is that the first view creates an editable item and then replaces itself with an editor for the item. When I do the obvious solution within the first view: MyEditViewController *mevc = [[MYEditViewController alloc] initWithGizmo: gizmo]; [self retain]; [self.navigationController popViewControllerAnimated: NO]; [self.navigationController pushViewController

UIView Hide/Show with animation

时间秒杀一切 提交于 2019-11-26 06:15:07
问题 My simple goal is to fade animate hiding and showing functions. Button.hidden = YES; Simple enough. However, is it possible to have it fade out rather than just disappearing? It looks rather unprofessional that way. 回答1: In iOS 4 and later, there's a way to do this just using the UIView transition method without needing to import QuartzCore. You can just say: [UIView transitionWithView:button duration:0.4 options:UIViewAnimationOptionTransitionCrossDissolve animations:^{ button.hidden = YES;

Changing back button in iOS 7 disables swipe to navigate back

我只是一个虾纸丫 提交于 2019-11-26 05:59:25
问题 I have an iOS 7 app where I am setting a custom back button like this: UIImage *backButtonImage = [UIImage imageNamed:@\"back-button\"]; UIButton *backButton = [UIButton buttonWithType:UIButtonTypeCustom]; [backButton setImage:backButtonImage forState:UIControlStateNormal]; backButton.frame = CGRectMake(0, 0, 20, 20); [backButton addTarget:self action:@selector(popViewController) forControlEvents:UIControlEventTouchUpInside]; UIBarButtonItem *backBarButtonItem = [[UIBarButtonItem alloc]

How to load GIF image in Swift?

早过忘川 提交于 2019-11-26 04:12:35
问题 I have a String with an URL of GIF banner which I need to put into app. My code: func showAdd(){ Request.get(\"http://www.kyst.no/api/?apiMode=advertisement&lang=no\", { (error: NSError?, data: NSData, text: NSString?) -> () in let jsonResult: Dictionary = NSJSONSerialization.JSONObjectWithData(data, options: NSJSONReadingOptions.MutableContainers, error: nil) as Dictionary<String, AnyObject> var banner : NSString = jsonResult[\"advertisement\"]![\"banner\"] as NSString self.addViewImage

UIButton can&#39;t be touched while animated with UIView animateWithDuration

和自甴很熟 提交于 2019-11-26 01:27:24
I have the following code: [UIView animateWithDuration:0.3 delay:0.0 options:UIViewAnimationCurveEaseOut | UIViewAnimationOptionAllowUserInteraction animations:^{ CGRect r = [btn frame]; r.origin.y -= 40; [btn setFrame: r]; } completion:^(BOOL done){ if(done){ [UIView animateWithDuration:0.3 delay:1 options:UIViewAnimationOptionCurveEaseIn | UIViewAnimationOptionAllowUserInteraction animations:^{ CGRect r = [btn frame]; r.origin.y += 40; [btn setFrame: r]; } completion:^(BOOL done){if(done) zombiePopping = 0; }]; } }]; The problem is, it seems the button doesnt respond to touches while being