Note that there are some explanatory texts on larger screens.

plurals
  1. POWeird animation during switch views
    primarykey
    data
    text
    <p>I create the views, UI elements etc programmatically. I'm trying to animate views when they are added or removed. The problem is that only UIButton *button is being animated and it is animated wrong. I mean the button title comes from the top and the button itself comes from the right of the screen.</p> <p>Please see the code below </p> <p>AppDelegate.h</p> <pre><code>#import &lt;UIKit/UIKit.h&gt; #import "TViewController.h" @interface AppDelegate : UIResponder &lt;UIApplicationDelegate&gt; { TViewController *tv; } @property (strong, nonatomic) TViewController *tv; @property (strong, nonatomic) UIWindow *window; @end </code></pre> <p>AppDelegate.m .....</p> <pre><code>- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease]; self.window.backgroundColor = [UIColor whiteColor]; self.tv = [[TViewController alloc]initWithNibName:@"TViewController" bundle:nil]; self.window.rootViewController = self.tv; [self.window makeKeyAndVisible]; return YES; } </code></pre> <p>TViewController.h</p> <pre><code>#import &lt;UIKit/UIKit.h&gt; #import "Elements.h" @interface TViewController : UIViewController { Elements *el; } @property (nonatomic, retain) Elements *el; @end </code></pre> <p>TViewController.m</p> <pre><code>-(void)loadView { self.view = [[UIView alloc]initWithFrame:[UIScreen mainScreen].applicationFrame]; self.el = [[Elements alloc] initWithNibName:@"Elements" bundle:nil]; [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:3.0]; [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self.view.superview cache:YES]; [self.view addSubview:self.el.view]; self.view.backgroundColor = [UIColor grayColor]; [self.view removeFromSuperview]; [UIView commitAnimations]; } </code></pre> <p>Elements.m</p> <pre><code>self.view = [[UIView alloc]initWithFrame:[UIScreen mainScreen].applicationFrame]; UILabel *howManyUsersLabel = [[UILabel alloc]initWithFrame:CGRectMake(10, 20, 300, 150)]; howManyUsersLabel.text = @"Label ..."; [self.view addSubview:howManyUsersLabel]; UIPickerView *playersPickerView = [[UIPickerView alloc] initWithFrame:CGRectMake(10, 150, 250, 100)]; playersPickerView.delegate = self; playersPickerView.showsSelectionIndicator = YES; [self.view addSubview:playersPickerView]; UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect]; button.frame = CGRectMake(20, 370, 280, 50); [button setTitle:@"Button" forState:UIControlStateNormal]; [self.view addSubview:button]; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload